#include using namespace std; const int MX = 1E5 + 1; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; int d = sqrt(MX); vector ans(MX); while (n--) { int u; cin >> u; for (int j = 1; j < d; j++) { if (u % j == 0) { ans[u] = max(ans[u], ans[j]); } } ans[u]++; if (u >= d) { for (int j = u; j < MX; j += u) { ans[j] = max(ans[j], ans[u]); } } } cout << *max_element(ans.begin(), ans.end()); }