#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 /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i = 0, t, x, ans[10000] = {0};
  int pos = 0, j;
  scanf("%d", &t);
  for (i = 0; i < t; i++) {
    scanf("%d", &x);
    x--;
    if (i == 0)
      continue;
    for (j = 0; j < pos; j++) {
      if (x % ans[j] == 0) {
        x = -1;
        break;
      }
    }
    if (x != -1)
      ans[pos++] = x;
  }
  printf("%d\n", pos);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9c60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x9c50(%rbp),%rdi
xor    %esi,%esi
mov    $0x9c40,%edx
call   1040 <memset@plt>
movl   $0x0,-0x9c54(%rbp)
lea    0xe93(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1247 <main+0x117>
lea    0xe70(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    11b1 <main+0x81>
jmp    1239 <main+0x109>
movl   $0x0,-0x9c58(%rbp)
mov    -0x9c58(%rbp),%eax
cmp    -0x9c54(%rbp),%eax
jge    120d <main+0xdd>
mov    -0x10(%rbp),%eax
movslq -0x9c58(%rbp),%rcx
cltd
idivl  -0x9c50(%rbp,%rcx,4)
cmp    $0x0,%edx
jne    11f4 <main+0xc4>
movl   $0xffffffff,-0x10(%rbp)
jmp    120d <main+0xdd>
jmp    11f9 <main+0xc9>
mov    -0x9c58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c58(%rbp)
jmp    11bb <main+0x8b>
cmpl   $0xffffffff,-0x10(%rbp)
je     1234 <main+0x104>
mov    -0x10(%rbp),%ecx
mov    -0x9c54(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x9c54(%rbp)
cltq
mov    %ecx,-0x9c50(%rbp,%rax,4)
jmp    1239 <main+0x109>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117d <main+0x4d>
mov    -0x9c54(%rbp),%esi
lea    0xdaf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x9c60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x9c50,%rsp
lea    0x10(%rsp),%rdi
xor    %r12d,%r12d
mov    $0x9c40,%edx
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xea6(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11e5 <main+0xb5>
xor    %r12d,%r12d
lea    0xe8b(%rip),%r14
lea    0x8(%rsp),%r15
xor    %ebp,%ebp
jmp    1199 <main+0x69>
movl   $0xffffffff,0x8(%rsp)
ff
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    11e5 <main+0xb5>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0x8(%rsp),%esi
lea    -0x1(%rsi),%ecx
mov    %ecx,0x8(%rsp)
test   %ebp,%ebp
je     1190 <main+0x60>
test   %r12d,%r12d
jle    11d4 <main+0xa4>
mov    %r12d,%edi
xor    %ebx,%ebx
nopl   (%rax)
mov    %ecx,%eax
cltd
idivl  0x10(%rsp,%rbx,4)
test   %edx,%edx
je     117e <main+0x4e>
add    $0x1,%rbx
cmp    %rbx,%rdi
jne    11c0 <main+0x90>
test   %esi,%esi
je     1190 <main+0x60>
movslq %r12d,%rax
add    $0x1,%r12d
mov    %ecx,0x10(%rsp,%rax,4)
jmp    1190 <main+0x60>
lea    0xe17(%rip),%rdi
mov    %r12d,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x9c50,%rsp
pop    %rbx
pop    %r12
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 [10000 x i32]
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%8 = bitcast [10000 x i32]* %5 to i8*
store i32 0, i32* %6
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %2
br label %10
10: ; preds = %49, %0
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %52
14: ; preds = %10
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%16 = load i32, i32* %4
%17 = add nsw i32 %16, -1
store i32 %17, i32* %4
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %14
br label %49
21: ; preds = %14
store i32 0, i32* %7
br label %22
22: ; preds = %36, %21
%23 = load i32, i32* %7
%24 = load i32, i32* %6
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %39
26: ; preds = %22
%27 = load i32, i32* %4
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [10000 x i32], [10000 x i32]* %5, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = srem i32 %27, %31
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %26
store i32 -1, i32* %4
br label %39
35: ; preds = %26
br label %36
36: ; preds = %35
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %22
39: ; preds = %34, %22
%40 = load i32, i32* %4
%41 = icmp ne i32 %40, -1
br i1 %41, label %42, label %48
42: ; preds = %39
%43 = load i32, i32* %4
%44 = load i32, i32* %6
%45 = add nsw i32 %44, 1
store i32 %45, i32* %6
%46 = sext i32 %44 to i64
%47 = getelementptr inbounds [10000 x i32], [10000 x i32]* %5, i64 0, i64 %46
store i32 %43, i32* %47
br label %48
48: ; preds = %42, %39
br label %49
49: ; preds = %48, %20
%50 = load i32, i32* %2
%51 = add nsw i32 %50, 1
store i32 %51, i32* %2
br label %10
52: ; preds = %10
%53 = load i32, i32* %6
%54 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %53)
ret i32 0
}

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 = alloca [10000 x i32]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast [10000 x i32]* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %42
10: ; preds = %0, %37
%11 = phi i32 [ %38, %37 ], [ 0, %0 ]
%12 = phi i32 [ %39, %37 ], [ 0, %0 ]
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
%15 = add nsw i32 %14, -1
store i32 %15, i32* %2
%16 = icmp eq i32 %12, 0
br i1 %16, label %37, label %17
17: ; preds = %10
%18 = icmp sgt i32 %11, 0
br i1 %18, label %19, label %31
19: ; preds = %17
%20 = zext i32 %11 to i64
br label %23
21: ; preds = %23
%22 = icmp eq i64 %29, %20
br i1 %22, label %31, label %23
23: ; preds = %19, %21
%24 = phi i64 [ 0, %19 ], [ %29, %21 ]
%25 = getelementptr inbounds [10000 x i32], [10000 x i32]* %3, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = srem i32 %15, %26
%28 = icmp eq i32 %27, 0
%29 = add nuw nsw i64 %24, 1
br i1 %28, label %30, label %21
30: ; preds = %23
store i32 -1, i32* %2
br label %37
31: ; preds = %21, %17
%32 = icmp eq i32 %14, 0
br i1 %32, label %37, label %33
33: ; preds = %31
%34 = add nsw i32 %11, 1
%35 = sext i32 %11 to i64
%36 = getelementptr inbounds [10000 x i32], [10000 x i32]* %3, i64 0, i64 %35
store i32 %15, i32* %36
br label %37
37: ; preds = %30, %31, %33, %10
%38 = phi i32 [ %11, %10 ], [ %34, %33 ], [ %11, %31 ], [ %11, %30 ]
%39 = add nuw nsw i32 %12, 1
%40 = load i32, i32* %1
%41 = icmp slt i32 %39, %40
br i1 %41, label %10, label %42
42: ; preds = %37, %0
%43 = phi i32 [ 0, %0 ], [ %38, %37 ]
%44 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %43)
ret i32 0
}