~cpp #include <iostream> using namespace std; int main() { int num, i, j, value, temp;//, maxNum; int numbers[3000], compare[3000]; bool jolly = false; while(cin >> num) { if(num == 0 && num <= 0) break; for(i = 0; i <= num-1; i++) { cin >> numbers[i]; } for(i = 0; i < 3000; i++) { compare[i] = 0; } for(i = num-1; i > 0; i--) { if(numbers[i] >= numbers[i-1]) value = numbers[i] - numbers[i-1]; else value = numbers[i-1] - numbers[i]; if(compare[i-1] != value) { compare[i] = value; } } for(i = 1; i <= num-1; i++) { for(j = i; j <= num-1; j++) { if(compare[i] >= compare[j]) { temp = compare[j]; compare[j] = compare[i]; compare[i] = temp; } } } for(i = 1; i <= num-1; i++) { if(compare[i] == i) jolly = true; else { jolly = false; break; } } if(num == 1) cout << "Jolly" << endl; else if (jolly) cout << "Jolly" << endl; else cout << "Not jolly" << endl; num = 0; } return 0; }