1.

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
* Problem: 10038 Jolly Jumper
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&page=show_problem&problem=979
*
* @author Anton Pavlushko, IBB7B,
* @version 1.0, 10/10/2010
*
* Status : Accepted
* Runtime: 0.280
*/

import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String current_line = "";
StringTokenizer input_string;
Vector check;
int n, j, difference;
int [] numbers;
boolean exits;

try {
while ((current_line=in.readLine())!= null) {
input_string = new StringTokenizer(current_line);
n = Integer.parseInt(input_string.nextToken());
if (n>0) {

numbers = new int[n+1];
check = new Vector();
exits = true;

for(j=0;(j<n && input_string.hasMoreTokens());j++) {
numbers[j+1]=Integer.parseInt(input_string.nextToken());
if (j>0) {
difference=Math.abs(numbers[j]-numbers[j+1]);
if (!check.contains(difference) && difference<n) check.add(difference);
else {
exits=false;
break;
}
}
}

if (!exits) System.out.println("Not jolly");
else if (n==1 && check.size()==0) System.out.println("Jolly");
else if (n!=1 && n-1==check.size()) System.out.println("Jolly");
else System.out.println("Not jolly");

} else System.out.println("Not jolly");
} // end while
} // end try
catch (IOException e) {
System.err.println("Error: " + e);
}
}
}