N = int(input()) x = sorted([int(i) for i in input().split()]) dp = [0 for i in range(N)] for i in range(N): for j in range(i,-1,-1): if x[i] % x[j] == 0: dp[i] = max(dp[i],dp[j] + 1) print (max(dp))