N=int(input()) X=set(list(map(int,input().split()))) DP=[0]*(10**6+1) for x in X: DP[x]=1 for i in range(10**6+1): if DP[i]: for j in range(2*i,10**6+1,i): if DP[j]: DP[j]=max(DP[j],DP[i]+1) print(max(DP))