The Longest Divisible Subsequence of a Subsequence#364

The Longest Divisible Subsequence of a Subsequence

1 second
64 megabytes
Medium (≈1350)

For the following numerical sequence a_1, a_2, …, a_n, it is required to find the length of the longest divisible subsequence.

A divisible subsequence a_{k_1}, a_{k_2}, …, a_{k_t} (k_1 < k_2 < … < k_t) has the property that a_{k_i} | a_{k_j} for 1 \le i < j \le t (where means "b is divisible by a"). A subsequence consisting of a single element is also considered divisible.

Input

The first line of the input file contains a natural number (1 \leq N \leq 1000) — the number of elements in the given sequence. The next line contains integers not exceeding 10^9 in absolute value — the sequence itself.

Output

The required answer should be a single number — the found length.

Examples

Example 1

Loading
Loading