#include using namespace std; #define int long long #define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++) #define all(x) (x).begin(), (x).end() #define sz(x) ((int)x.size()) template bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } /* */ using vi = vector; using vvi = vector; using P = pair; int dp[301010]; signed main() { int n; cin >> n; vi a(n); rep(i, 0, n) cin >> a[i]; int ans = 0; rep(i, 0, n){ int ma = 1; rep(j, 1, a[i]/j+1) if(a[i]%j == 0){ if(a[i] != 1) chmax(ma, dp[j]+1); if(j > 1) chmax(ma, dp[a[i]/j]+1); } chmax(dp[a[i]], ma); chmax(ans, ma); } cout << ans << endl; return 0; }