#include #define MOD 1000000007 using namespace std; int N; int num[100001] = {0}; int dp[1000001] = {0}; int main(void){ cin >> N; int i, j; for(i = 0; i < N; ++i){ cin >> num[i]; } sort(num, num + N); for(i = 0; i < N; ++i) dp[num[i]] = 1; for(i = 0; i < N; ++i){ for(j = 0; j < i; ++j){ if(num[i] % num[j] == 0) dp[num[i]] = max(dp[num[i]], dp[num[j]] + 1); } } int result = 0; for(i = 0; i < N; ++i) result = max(result, dp[num[i]]); cout << result << endl; return 0; }