#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 */

/* Variables and functions */
int jestePerioda(int, int *, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, n, T;
  scanf("%d", &n);
  int x[n];
  for (i = 0; i < n; i++)
    scanf("%d", &x[i]);
  scanf("%d", &T);
  printf("%d\n", jestePerioda(n, x, T));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b2 <main+0x82>
mov    -0x28(%rbp),%rsi
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe61(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117d <main+0x4d>
lea    0xe47(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x28(%rbp),%rsi
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%edx
call   1030 <jestePerioda@plt>
mov    %eax,%esi
lea    0xe29(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebb(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1050 <scanf@plt>
mov    %rsp,%r12
mov    -0x2c(%rbp),%eax
mov    %rsp,%r14
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
cmpl   $0x0,-0x2c(%rbp)
jle    119c <main+0x6c>
xor    %r13d,%r13d
lea    0xe87(%rip),%r15
mov    %r14,%rbx
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x1,%r13
movslq -0x2c(%rbp),%rax
add    $0x4,%rbx
cmp    %rax,%r13
jl     1180 <main+0x50>
lea    0xe5d(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x2c(%rbp),%edi
mov    -0x30(%rbp),%edx
mov    %r14,%rsi
call   1030 <jestePerioda@plt>
lea    0xe42(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %r12,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = zext i32 %8 to i64
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %5
%11 = alloca i32, i64 %9
store i64 %9, i64* %6
store i32 0, i32* %2
br label %12
12: ; preds = %21, %0
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %11, i64 %18
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %19)
br label %21
21: ; preds = %16
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %12
24: ; preds = %12
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = call i32 @jestePerioda(i32 %26, i32* %11, i32 %27)
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
store i32 0, i32* %1
%30 = load i8*, i8** %5
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
%9 = alloca i32, i64 %7
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %0, %12
%13 = phi i64 [ %16, %12 ], [ 0, %0 ]
%14 = getelementptr inbounds i32, i32* %9, i64 %13
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %14)
%16 = add nuw nsw i64 %13, 1
%17 = load i32, i32* %1
%18 = sext i32 %17 to i64
%19 = icmp slt i64 %16, %18
br i1 %19, label %12, label %20
20: ; preds = %12, %0
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = call i32 @jestePerioda(i32 %22, i32* %9, i32 %23)
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
ret i32 0
}