import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def SI(): return sys.stdin.readline()[:-1] from collections import defaultdict def div(a): res=[] for d in range(1,a): if d**2==a: res+=[d] break if d**2>a:break if a%d==0:res+=[d,a//d] return res def main(): n=II() aa=LI() lds=defaultdict(int) for a in aa: dd=div(a) val=0 for d in dd: if d==a:continue if lds[d]>val:val=lds[d] lds[a]=val+1 #print(lds) print(max(lds.values())) main()