|
#include <bits/stdc++.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using namespace std; |
|
|
|
typedef signed long long ll; |
|
typedef unsigned long long ull; |
|
|
|
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); |
|
|
|
int N; |
|
int freq[3001], a, b; |
|
|
|
int main () { |
|
fastio; |
|
|
|
while ( cin >> N && !cin.eof() ){ |
|
memset(freq, 0, sizeof(freq)); |
|
|
|
bool isJolly = true; |
|
|
|
cin >> a; |
|
for (int i = 1; i < N; ++i){ |
|
cin >> b; |
|
|
|
if (abs(a-b) >= N) isJolly = false; |
|
else freq[abs(a-b)]++; |
|
|
|
a = b; |
|
} |
|
|
|
for (int i = 1; i < N; ++i) |
|
isJolly &= freq[i]; |
|
|
|
cout << (isJolly? "Jolly" : "Not jolly") << '\n'; |
|
|
|
} |
|
|
|
return 0; |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|