#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 sqrt(int);
int main(void) {
  int num, temp, i, j, count = 0;
  scanf("%d", &num);
  for (i = 0; i < num; i++) {
    scanf("%d", &temp);
    for (j = 2; j <= sqrt(temp); j++) {
      if (temp % j == 0)
        break;
    }
    if (j > sqrt(temp) || sqrt(temp) < 2)
      count++;
  }
  printf("%d\n", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    120b <main+0xdb>
lea    0xe90(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jg     11c3 <main+0x93>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%edx
jne    11b0 <main+0x80>
jmp    11c3 <main+0x93>
jmp    11b5 <main+0x85>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1180 <main+0x50>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jg     11ef <main+0xbf>
mov    -0xc(%rbp),%edi
call   1050 <sqrt@plt>
cmp    $0x2,%eax
jge    11f8 <main+0xc8>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11fd <main+0xcd>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115d <main+0x2d>
mov    -0x18(%rbp),%esi
lea    0xdee(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11ed <main+0xbd>
xor    %r12d,%r12d
lea    0xe9f(%rip),%r14
mov    %rsp,%r15
xor    %r13d,%r13d
jmp    117f <main+0x4f>
nopl   0x0(%rax)
add    $0x1,%r12d
add    $0x1,%r13d
cmp    0x4(%rsp),%r13d
jge    11f0 <main+0xc0>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%edi
call   1050 <sqrt@plt>
mov    $0x2,%ebx
cmp    $0x2,%eax
jl     11d2 <main+0xa2>
mov    $0x2,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rsp),%edi
mov    %edi,%eax
cltd
idiv   %ebp
test   %edx,%edx
je     11d0 <main+0xa0>
lea    0x1(%rbp),%ebx
call   1050 <sqrt@plt>
cmp    %eax,%ebp
mov    %ebx,%ebp
jl     11b0 <main+0x80>
jmp    11d2 <main+0xa2>
nopl   0x0(%rax)
mov    %ebp,%ebx
mov    (%rsp),%edi
call   1050 <sqrt@plt>
cmp    %eax,%ebx
jg     1170 <main+0x40>
mov    (%rsp),%edi
call   1050 <sqrt@plt>
cmp    $0x1,%eax
jle    1170 <main+0x40>
jmp    1174 <main+0x44>
xor    %r12d,%r12d
lea    0xe0c(%rip),%rdi
mov    %r12d,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%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 i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %4
br label %8
8: ; preds = %42, %0
%9 = load i32, i32* %4
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %45
12: ; preds = %8
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 2, i32* %5
br label %14
14: ; preds = %26, %12
%15 = load i32, i32* %5
%16 = load i32, i32* %3
%17 = call i32 @sqrt(i32 %16)
%18 = icmp sle i32 %15, %17
br i1 %18, label %19, label %29
19: ; preds = %14
%20 = load i32, i32* %3
%21 = load i32, i32* %5
%22 = srem i32 %20, %21
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %19
br label %29
25: ; preds = %19
br label %26
26: ; preds = %25
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %14
29: ; preds = %24, %14
%30 = load i32, i32* %5
%31 = load i32, i32* %3
%32 = call i32 @sqrt(i32 %31)
%33 = icmp sgt i32 %30, %32
br i1 %33, label %38, label %34
34: ; preds = %29
%35 = load i32, i32* %3
%36 = call i32 @sqrt(i32 %35)
%37 = icmp slt i32 %36, 2
br i1 %37, label %38, label %41
38: ; preds = %34, %29
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %41
41: ; preds = %38, %34
br label %42
42: ; preds = %41
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %8
45: ; preds = %8
%46 = load i32, i32* %6
%47 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %46)
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 = 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 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %40
8: ; preds = %0, %35
%9 = phi i32 [ %36, %35 ], [ 0, %0 ]
%10 = phi i32 [ %37, %35 ], [ 0, %0 ]
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
%13 = call i32 @sqrt(i32 %12)
%14 = icmp slt i32 %13, 2
br i1 %14, label %24, label %15
15: ; preds = %8, %20
%16 = phi i32 [ %21, %20 ], [ 2, %8 ]
%17 = load i32, i32* %2
%18 = srem i32 %17, %16
%19 = icmp eq i32 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %15
%21 = add nuw nsw i32 %16, 1
%22 = call i32 @sqrt(i32 %17)
%23 = icmp slt i32 %16, %22
br i1 %23, label %15, label %24
24: ; preds = %20, %15, %8
%25 = phi i32 [ 2, %8 ], [ %16, %15 ], [ %21, %20 ]
%26 = load i32, i32* %2
%27 = call i32 @sqrt(i32 %26)
%28 = icmp sgt i32 %25, %27
br i1 %28, label %33, label %29
29: ; preds = %24
%30 = load i32, i32* %2
%31 = call i32 @sqrt(i32 %30)
%32 = icmp slt i32 %31, 2
br i1 %32, label %33, label %35
33: ; preds = %29, %24
%34 = add nsw i32 %9, 1
br label %35
35: ; preds = %29, %33
%36 = phi i32 [ %34, %33 ], [ %9, %29 ]
%37 = add nuw nsw i32 %10, 1
%38 = load i32, i32* %1
%39 = icmp slt i32 %37, %38
br i1 %39, label %8, label %40
40: ; preds = %35, %0
%41 = phi i32 [ 0, %0 ], [ %36, %35 ]
%42 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %41)
ret i32 0
}