PC/UVa:110201/10038
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main()
{
int n = 0, minus;
while (cin >> n){
vector<int> vi(n, 0);
vector<bool> vb(n, false);
for (int i = 0; i < n; i++)
{
cin >> vi[i];
}
for (int i = 1; i < n; i++)
{
minus = abs(vi[i] - vi[i - 1]);
if (minus > 0 && minus < n) vb[minus] = true;
}
int i = 1;
while (i < n){
if (!vb[i]){
cout << "Not jolly" << endl;
break;
}
i++;
}
if (i == n) cout << "Jolly" << endl;
}
return 0;
}
/*
4 1 4 2 3
5 1 4 2 -1 6
*/