D. Good Sequences
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
数列 n 有 a1, a2, ..., an 个数(严格递增),请从中任意删去一些数,使序列相邻2数都不互质。
问删后序列最长长度.
Input
第一行 n (1 ≤ n ≤ 105) 第二行序列 a1, a2, ..., an (1 ≤ ai ≤ 105; ai < ai + 1).
Output
删后序列最长长度.
Sample test(s)
input
5 2 3 4 6 9
output
4
input
9 1 2 3 5 6 7 8 9 10
output
4
Note
In the first example, the following sequences are examples of good sequences: [2; 4; 6; 9], [2; 4; 6], [3; 9], [6]. The length of the longest good sequence is 4.