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
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Đế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 having exactly two positive divisors: and itself. You are given a list of integers . Count the entries that are prime. Each occurrence is counted separately, even when values repeat.
Input
The first line contains , the number of elements. Each of the following lines contains one integer .
Output
Print one integer: the number of prime entries in the input list.
Subtasks
- Subtask 1 (20 points): , for every .
- Subtask 2 (30 points): , for every .
- Subtask 3 (50 points): , for every .
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.