#include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i, n) for(int i = 0; i < n; i++) #define RREP(i,n) for(int i = (n)-1; i >= 0; i--) #define FOR(i, l, r) for(int i = l; i < r; i++) #define RFOR(i, l,r) for(int i= (l)-1; i>= (r) ; i--) constexpr int INF = 1000000000;/* 1e+9a */ constexpr int MODULO = 1000000007; int max_v = 1; vector depth; int calc(vector& p, int n = 0, int dep = 1) { int thi = n; if(depth[n] != INF) return depth[n]; int t_max = dep; FOR(i, n+1, p.size()) { if(p[i] % p[thi] == 0) { int tmp = calc(p, i, dep+1); t_max = t_max > tmp ? t_max : tmp; } } return depth[thi] = t_max; } int solve(vector& p) { calc(p); return *max_element(depth.begin(), depth.end()); } int main() { ios::sync_with_stdio(false); int n; cin >> n; vector p; REP(i, n) { int tmp; cin >> tmp; p.push_back(tmp); } sort(p.begin(),p.end()); REP(i, n) { depth.push_back(INF); } cout << solve(p) << '\n'; }