import bisect N = int(input()) A = list(map(int,input().split())) A.sort() L = [1]*N for i in range(N): for j in range(bisect.bisect_left(A, A[i]*2),N): if A[j]%A[i]==0: L[j] = max(L[j],L[i]+1) print(max(L))