# 集合は 元の重複を許さない from collections import defaultdict N = int(input()) X = list(map(int, input().split())) setX = set(X) X.sort() limit = max(X) dp = defaultdict(int) def chmax(DP,i,v): if DP[i] < v: DP[i] = v def chmin(DP,i,v): if DP[i] > v: DP[i] = v for x in X: chmax(dp, x, 1) for dst in range(2*x, limit + 1, x): if dst in setX: chmax(dp, dst, dp[x] + 1) ans = max(dp.values()) print(ans)