n=int(input()) a=list(map(int,input().split())) L=max(a) o=[0]*(L+1) for v in a: o[v]=1 q=[0]*(L+1) for i in range(1,L+1): q[i]+=o[i] for j in range(i+i,L+1,i): q[j]=max(q[j],q[i]) print(max(q[i] for i in range(L+1) if o[i]))