#include <bits/stdc++.h>   using namespace std;   int a[100000], d[100000];   int main() {     int n, ans = 0;     cin >> n;     for (int i = 0; i < n; i++) scanf( %d , &a[i]);     vector<int> p;     for (int i = 0; i < n; i++) {       if (a[i] == 1) ans = max(ans, 1);       p.clear();       int x = a[i];       int k = 0;       for (int j = 2; j <= sqrt(x); j++)         if (x % j == 0) {           p.push_back(j);           k = max(k, d[j] + 1);           while (x % j == 0) x /= j;         }       if (x > 1) {         p.push_back(x);         k = max(k, d[x] + 1);       }       ans = max(ans, k);       for (int j = 0; j < p.size(); j++) d[p[j]] = max(d[p[j]], k);     }     cout << ans;     return 0;   }   