import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N, *X = map(int,read().split()) U = 10 ** 6 + 1 dp = np.zeros(U, np.int8) X.sort() for x in X: np.maximum(dp[x] + 1, dp[x+x:U:x], out=dp[x+x:U:x]) answer = dp[X].max() + 1 print(answer)