n,*a = map(int,open(0).read().split()) M = 300005 d = [[] for _ in range(M)] for i in range(1,M): for j in range(i*2,M,i): d[j].append(i) r = [0]*M for ai in a: r[ai] = max(r[di] for di in d[ai])+1 if ai>1 else 1 print(max(r))