def read_data(): N = int(input()) Xs = list(map(int, input().split())) return N, Xs def solve(N, Xs): maxX = max(Xs) dp = [0] * (maxX + 1) for x in Xs: dp[x] = 1 for i in range(1, maxX + 1): di = dp[i] if di == 0: continue for j in range(i * 2, maxX + 1, i): if dp[j] and di >= dp[j]: dp[j] = di + 1 return max(dp) N, Xs = read_data() print(solve(N, Xs))