1 /*
2 * File: 10038.cpp
3 * Author: GongZhi
4 * Problem: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=30&page=show_problem&problem=979
5 * Created on 2009年7月27日, 上午1:10
6 */
7
8 #include <stdlib.h>
9 #include <string.h>
10 #include <iostream>
11 #include <string>
12 #include <vector>
13 #include <map>
14 #include <queue>
15 using namespace std;
16
17 /*
18 *
19 */
20 int a[4000];
21 char mark[4000];
22
23 int main() {
24 int n, i, t, f;
25 while (scanf("%d", &n) != EOF) {
26 f = 1;
27 for (i = 0; i < n; i++)scanf("%d", &a[i]);
28 memset(mark, 0, sizeof (mark));
29 for (i = 1; i < n; i++) {
30 t = a[i] - a[i - 1];
31 if (t < 0)t = -t;
32 if (t >= n)f = 0;
33 if (!f)break;
34 if(mark[t])f=0;
35 mark[t]=1;
36 if (!f)break;
37 }
38 if(f)printf("Jolly\n");
39 else printf("Not jolly\n");
40 }
41 return 0;
42 }
43
44