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

#GL0000100. Nikita và BCNN (Nikita and LCM)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Nikita và BCNN (Nikita and LCM)

Nikita and LCM

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Given an array aa of nn positive integers, choose any subsequence by deleting elements while preserving order. A subsequence is special if the least common multiple of its elements is not present in the original array aa. By convention, the LCM of the empty subsequence is 00. Find the maximum possible length of a special subsequence.

Input

The first line contains nn. The second line contains nn positive integers a1,…,ana_1,\ldots,a_n.

Output

Print the maximum length of a special subsequence.

Subtasks

  • Subtask 1 (20 points): 1≤n≤121\le n\le 12; 1≤ai≤1201\le a_i\le 120.
  • Subtask 2 (30 points): 1≤n≤2001\le n\le 200; 1≤ai≤1061\le a_i\le 10^6.
  • Subtask 3 (50 points): 1≤n≤20001\le n\le 2000; 1≤ai≤1091\le a_i\le 10^9.

Examples

Input

6
3 2 10 20 60 1

Output

4

Explanation

Choose the original-order subsequence 3,2,10,13,2,10,1, with LCM 3030, which is absent from the original array. Its length is 44, and no special subsequence of length 55 exists.