#d1102. 最长因子链
最长因子链
Longest Factor Chain
Problem Description
Given an array of length , find the length of the longest factor chain. That is, find the largest and indices such that the are pairwise distinct and is a factor of , is a factor of ,
Note that a number is a factor of itself, and the numbers do not need to appear in order.
Input Format
The first line contains an integer .
The next line contains integers .
Output Format
One integer — the answer.
Sample Input
6
3 7 4 2 6 8
Sample Output
3
Constraints
All data satisfy and .