#include using namespace std; int main() { int n; cin >> n; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } vector dp(3e5 + 1, 0); for (auto&& x : a) { for (int i = 1; i * i <= x; i++) { if (x % i == 0) { int j = x / i; if (i < x) dp[x] = max(dp[x], dp[i] + 1); if (j < x) dp[x] = max(dp[x], dp[j] + 1); } } dp[x] = max(dp[x], 1); } cout << *max_element(begin(dp), end(dp)) << endl; }