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

#SP0000193. Nguyên tố trong tập hợp số hợp (Composite Prime)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Nguyên tố trong tập hợp số hợp (Composite Prime)

Composite Prime

PHOJ ID: PRIME000198
Original source: UVa 11086
Version: PHOJ Extended, one dataset per run.

Problem statement

Let MM be the set of composite positive integers. A member is a composite prime if it has no proper divisor also belonging to MM. Equivalently, it has exactly two prime factors counted with multiplicity: p2p^2 or pqpq for primes p,qp,q. Count such elements in a given list.

Input

The first line is NN; the next contains NN positive integers aia_i. (PHOJ single-dataset version; value bounds are PHOJ-specific.)

Output

Print the count of qualifying array elements, including repetitions at different positions.

Subtasks

  • Subtask 1 (20 points): 1≤N≤100, 1≤ai≤1041\le N\le100,\ 1\le a_i\le10^4.
  • Subtask 2 (30 points): 1≤N≤103, 1≤ai≤1061\le N\le10^3,\ 1\le a_i\le10^6.
  • Subtask 3 (50 points): 1≤N≤220, 1≤ai≤2201\le N\le2^{20},\ 1\le a_i\le2^{20}.

Example

Input

4
3 4 6 8

Output

2

Explanation

4=2×2 and 6=2×3 are composite primes, 3 is prime, and 8 has composite divisor 4. Thus the answer is 2.