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

#GL0000139. Ngày trọng đại của Bash (Bash’s Big Day)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Ngày trọng đại của Bash (Bash’s Big Day)

Bash's Big Day

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Bash visits Professor Zulu to select Pokémon. There are nn Pokémon, and the ii-th has a positive integer strength sis_i. Bash may choose any subset.

A group containing at least two Pokémon will fight if the GCD of their strengths equals 11. A single Pokémon is always allowed, even when its strength is 11. Find the maximum number of Pokémon Bash can select without a fight.

Input

The first line contains nn; the second contains the strengths sis_i.

Output

Print one integer: the maximum number of Pokémon Bash can select.

Subtasks

  • Subtask 1 (20 points): 1≤n≤201\le n\le 20; 1≤si≤1001\le s_i\le 100.
  • Subtask 2 (30 points): 1≤n≤5 0001\le n\le 5\,000; 1≤si≤10 0001\le s_i\le 10\,000.
  • Subtask 3 (50 points): 1≤n≤100 0001\le n\le 100\,000; 1≤si≤100 0001\le s_i\le 100\,000.

Examples

Input

5
2 3 4 6 7

Output

3

Explanation

Choosing strengths 2,4,62,4,6 gives GCD 22, so three Pokémon can be taken together. Every group of four has GCD 11, hence the optimum is three.