MAX = 10**6 n = input() X = map(int, raw_input().split()) con = [0]*(MAX+1) for x in X: con[x] = 1 dp = {} ma = max(X) def dfs(base): if base in dp: return dp[base] res = 1 cur = base+base while cur <= MAX or cur <= ma: if con[cur]: res = max(res, 1+dfs(cur)) cur += base dp[base] = res return res ans = 0 for x in X: ans = max(ans, dfs(x)) print ans