#include using namespace std; using ll = long long; using ld = long double; using vi = vector; using vvi = vector; using vb = vector; using vvb = vector; using vl = vector; using vvl = vector; using vd = vector; using vvd = vector; #define REP(i,n) for(ll i = 0; i < (n); ++i) #define ALL(c) (c).begin(), (c).end() #define FOR(i,s,e) for (ll i = s; i < (ll)e; i++) #define TEN(x) ((ll)1e##x) int main() { #ifdef _WIN32 ifstream cin("sample.in"); ofstream cout("sample.out"); #endif cin.tie(0); // cinとcoutの連携を切る ios_base::sync_with_stdio(false); cout << fixed << setprecision(50); ll n; cin >> n; vl x(n); REP(i, n) cin >> x[i]; sort(ALL(x)); x.erase(unique(ALL(x)), x.end()); vb exist(x.back() + 1, false); REP(i, x.size()) exist[x[i]] = true; vl dp(x.back() + 1); REP(i, x.back() + 1) if (exist[i]) dp[i] = 1; REP(i, x.back() + 1) if(exist[i]) for (ll j = 2; i * j < x.back() + 1; j++) if(exist[i * j]) dp[i * j] = max(dp[i * j], dp[i] + 1); ll ma = 0; REP(i, x.back() + 1) ma = max(ma, dp[i]); cout << ma << endl; return 0; }