PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#SP0000004. Đếm số nguyên tố trong dãy (Prime Numbers)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Đếm số nguyên tố trong dãy (Prime Numbers)

Prime Numbers

Source: Aizu Online Judge

Version: Phuoc Hung OJ Extended

Problem Statement

A prime number is an integer greater than 11 having exactly two positive divisors: 11 and itself. You are given a list of NN integers a1,a2,…,aNa_1,a_2,\ldots,a_N. Count the entries that are prime. Each occurrence is counted separately, even when values repeat.

Input

The first line contains NN, the number of elements. Each of the following NN lines contains one integer aia_i.

Output

Print one integer: the number of prime entries in the input list.

Subtasks

  • Subtask 1 (20 points): 1≤N≤1001\le N\le 100, 2≤ai≤100002\le a_i\le 10000 for every 1≤i≤N1\le i\le N.
  • Subtask 2 (30 points): 1≤N≤10001\le N\le 1000, 2≤ai≤10000002\le a_i\le 1000000 for every 1≤i≤N1\le i\le N.
  • Subtask 3 (50 points): 1≤N≤100001\le N\le 10000, 2≤ai≤1000000002\le a_i\le 100000000 for every 1≤i≤N1\le i\le N.

Examples

Input

5
2
3
4
5
6

Output

3

Explanation

The list has 5 values. Its prime entries are 2, 3, 5; there are 3 of them. Therefore print 3.

Input

11
7
8
9
10
11
12
13
14
15
16
17

Output

4

Explanation

The list has 11 values. Its prime entries are 7, 11, 13, 17; there are 4 of them. Therefore print 4.