#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ chk;

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
scalar_t__ scanf(char *, int *, ...);
int main(void) {
  int i, n, p, m, d, f;
  char chk[3000];
  while (scanf("%d %d", &n, &p) != EOF) {
    memset(chk, 0, sizeof(chk));
    for (i = f = 0; i < n - 1; i++) {
      scanf("%d", &m);
      d = m > p ? m - p : p - m;
      p = m;
      f = f || !d || chk[d]++ || d > n - 1;
    }
    printf(f ? "Not jolly\n" : "Jolly\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xbf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
mov    0x2e89(%rip),%rcx
cmp    (%rcx),%rax
je     1285 <main+0x155>
lea    -0xbe0(%rbp),%rdi
xor    %esi,%esi
mov    $0xbb8,%edx
call   1040 <memset@plt>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1263 <main+0x133>
lea    0xe62(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11c9 <main+0x99>
mov    -0x14(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0xbe4(%rbp)
jmp    11d5 <main+0xa5>
mov    -0x10(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0xbe4(%rbp)
mov    -0xbe4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x1c(%rbp)
mov    %al,-0xbe5(%rbp)
jne    1247 <main+0x117>
mov    $0x1,%al
cmpl   $0x0,-0x18(%rbp)
mov    %al,-0xbe5(%rbp)
je     1247 <main+0x117>
movslq -0x18(%rbp),%rcx
mov    -0xbe0(%rbp,%rcx,1),%al
mov    %al,%dl
add    $0x1,%dl
mov    %dl,-0xbe0(%rbp,%rcx,1)
movsbl %al,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0xbe5(%rbp)
jne    1247 <main+0x117>
mov    -0x18(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
setg   %al
mov    %al,-0xbe5(%rbp)
mov    -0xbe5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1189 <main+0x59>
mov    -0x1c(%rbp),%ecx
lea    0xda4(%rip),%rdi
lea    0xd92(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
call   1030 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0xbf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xbc8,%rsp
lea    0xeb8(%rip),%rdi
lea    0x4(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x2e88(%rip),%r13
cmp    0x0(%r13),%rax
jne    117a <main+0x4a>
xor    %eax,%eax
add    $0xbc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x10(%rsp),%r14
lea    0xe7d(%rip),%r15
lea    0xc(%rsp),%rbx
lea    0xe6e(%rip),%r12
lea    0x4(%rsp),%rbp
jmp    11c4 <main+0x94>
nopl   0x0(%rax)
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    0x0(%r13),%rax
je     1166 <main+0x36>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xbb8,%edx
call   1040 <memset@plt>
cmpl   $0x2,0x4(%rsp)
jl     11a0 <main+0x70>
mov    %r14,%rbp
xor    %r12d,%r12d
xor    %r14d,%r14d
jmp    1204 <main+0xd4>
cs nopw 0x0(%rax,%rax,1)
nop
movzbl %al,%r12d
add    $0x1,%r14d
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    %eax,%r14d
jge    1260 <main+0x130>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%edx
mov    %eax,%ecx
mov    %eax,0x8(%rsp)
sub    %edx,%eax
neg    %eax
sub    %edx,%ecx
cmovle %eax,%ecx
mov    $0x1,%al
test   %r12d,%r12d
jne    11f0 <main+0xc0>
test   %ecx,%ecx
je     11f0 <main+0xc0>
movslq %ecx,%rdx
movzbl 0x10(%rsp,%rdx,1),%esi
lea    0x1(%rsi),%edi
mov    %dil,0x10(%rsp,%rdx,1)
test   %sil,%sil
jne    11f0 <main+0xc0>
cmp    0x4(%rsp),%ecx
setge  %al
jmp    11f0 <main+0xc0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xd9f(%rip),%rdi
test   %r12d,%r12d
mov    %rbp,%r14
lea    0xd8c(%rip),%r12
lea    0x4(%rsp),%rbp
je     11a0 <main+0x70>
jmp    11a7 <main+0x77>

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@EOF = global i64 0
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"Not jolly\0A\00"
@.str.3 = [7 x i8] c"Jolly\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [3000 x i8]
store i32 0, i32* %1
br label %9
9: ; preds = %61, %0
%10 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%11 = load i64, i64* @EOF
%12 = icmp ne i64 %10, %11
br i1 %12, label %13, label %67
13: ; preds = %9
%14 = getelementptr inbounds [3000 x i8], [3000 x i8]* %8, i64 0, i64 0
%15 = call i32 @memset(i8* %14, i32 0, i32 3000)
store i32 0, i32* %7
store i32 0, i32* %2
br label %16
16: ; preds = %58, %13
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = sub nsw i32 %18, 1
%20 = icmp slt i32 %17, %19
br i1 %20, label %21, label %61
21: ; preds = %16
%22 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%23 = load i32, i32* %5
%24 = load i32, i32* %4
%25 = icmp sgt i32 %23, %24
br i1 %25, label %26, label %30
26: ; preds = %21
%27 = load i32, i32* %5
%28 = load i32, i32* %4
%29 = sub nsw i32 %27, %28
br label %34
30: ; preds = %21
%31 = load i32, i32* %4
%32 = load i32, i32* %5
%33 = sub nsw i32 %31, %32
br label %34
34: ; preds = %30, %26
%35 = phi i32 [ %29, %26 ], [ %33, %30 ]
store i32 %35, i32* %6
%36 = load i32, i32* %5
store i32 %36, i32* %4
%37 = load i32, i32* %7
%38 = icmp ne i32 %37, 0
br i1 %38, label %55, label %39
39: ; preds = %34
%40 = load i32, i32* %6
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %55
42: ; preds = %39
%43 = load i32, i32* %6
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [3000 x i8], [3000 x i8]* %8, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = add i8 %46, 1
store i8 %47, i8* %45
%48 = sext i8 %46 to i32
%49 = icmp ne i32 %48, 0
br i1 %49, label %55, label %50
50: ; preds = %42
%51 = load i32, i32* %6
%52 = load i32, i32* %3
%53 = sub nsw i32 %52, 1
%54 = icmp sgt i32 %51, %53
br label %55
55: ; preds = %50, %42, %39, %34
%56 = phi i1 [ true, %42 ], [ true, %39 ], [ true, %34 ], [ %54, %50 ]
%57 = zext i1 %56 to i32
store i32 %57, i32* %7
br label %58
58: ; preds = %55
%59 = load i32, i32* %2
%60 = add nsw i32 %59, 1
store i32 %60, i32* %2
br label %16
61: ; preds = %16
%62 = load i32, i32* %7
%63 = icmp ne i32 %62, 0
%64 = zext i1 %63 to i64
%65 = select i1 %63, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
%66 = call i32 @printf(i8* %65)
br label %9
67: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@EOF = global i64 0
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"Not jolly\0A\00"
@.str.3 = [7 x i8] c"Jolly\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [3000 x i8]
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = getelementptr inbounds [3000 x i8], [3000 x i8]* %4, i64 0, i64 0
%9 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%10 = load i64, i64* @EOF
%11 = icmp eq i64 %9, %10
br i1 %11, label %53, label %12
12: ; preds = %0, %47
%13 = call i32 @memset(i8* %8, i32 0, i32 3000)
%14 = load i32, i32* %1
%15 = icmp sgt i32 %14, 1
br i1 %15, label %16, label %46
16: ; preds = %12, %38
%17 = phi i32 [ %40, %38 ], [ 0, %12 ]
%18 = phi i32 [ %41, %38 ], [ 0, %12 ]
%19 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%20 = load i32, i32* %3
%21 = load i32, i32* %2
%22 = icmp sgt i32 %20, %21
%23 = sub nsw i32 %20, %21
%24 = sub nsw i32 %21, %20
%25 = select i1 %22, i32 %23, i32 %24
store i32 %20, i32* %2
%26 = icmp eq i32 %17, 0
%27 = icmp ne i32 %25, 0
%28 = select i1 %26, i1 %27, i1 false
br i1 %28, label %29, label %38
29: ; preds = %16
%30 = sext i32 %25 to i64
%31 = getelementptr inbounds [3000 x i8], [3000 x i8]* %4, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = add i8 %32, 1
store i8 %33, i8* %31
%34 = icmp eq i8 %32, 0
br i1 %34, label %35, label %38
35: ; preds = %29
%36 = load i32, i32* %1
%37 = icmp sge i32 %25, %36
br label %38
38: ; preds = %35, %29, %16
%39 = phi i1 [ true, %29 ], [ true, %16 ], [ %37, %35 ]
%40 = zext i1 %39 to i32
%41 = add nuw nsw i32 %18, 1
%42 = load i32, i32* %1
%43 = add nsw i32 %42, -1
%44 = icmp slt i32 %41, %43
br i1 %44, label %16, label %45
45: ; preds = %38
br i1 %39, label %47, label %46
46: ; preds = %12, %45
br label %47
47: ; preds = %45, %46
%48 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), %46 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), %45 ]
%49 = call i32 @printf(i8* dereferenceable(1) %48)
%50 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%51 = load i64, i64* @EOF
%52 = icmp eq i64 %50, %51
br i1 %52, label %53, label %12
53: ; preds = %47, %0
ret i32 0
}