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

#GL0000183. Không bị chia hết bởi phần tử khác (Not Divisible)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Không bị chia hết bởi phần tử khác (Not Divisible)

Not Divisible

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

You are given positive integers A1,A2,…,ANA_1,A_2,\ldots,A_N. An index ii is valid if there is no different index j≠ij\ne i such that AjA_j divides AiA_i. Duplicate values are allowed and invalidate every occurrence of that value. Count the valid indices.

Input

The first line contains NN. The second line contains NN integers A1,A2,…,ANA_1,A_2,\ldots,A_N.

Output

Print the number of valid indices.

Subtasks

  • Subtask 1 (20 points): 1≤N≤1001 \le N \le 100, 1≤Ai≤10001 \le A_i \le 1000.

  • Subtask 2 (30 points): 1≤N≤50001 \le N \le 5000, 1≤Ai≤1000001 \le A_i \le 100000.

  • Subtask 3 (50 points): 1≤N≤2000001 \le N \le 200000, 1≤Ai≤10000001 \le A_i \le 1000000.

Examples

Example 1

Input

5
24 11 8 3 16

Output

3

Explanation

Indices 2,3,42,3,4 qualify, with values 11,8,311,8,3. The value 2424 is divisible by 88 and 33, while 1616 is divisible by 88.

Example 2

Input

4
5 5 5 5

Output

0

Explanation

All four values equal 55. Each occurrence is divisible by the 55 at another index, so none is valid.

Example 3

Input

10
33 18 45 28 8 19 89 86 2 4

Output

5

Explanation

The five valid values are 33,45,19,89,233,45,19,89,2. In contrast, 8686 is not valid because the array also contains 22.