# yukicoder No.390 最長の数列 N = int(input()) X = sorted([int(x) for x in input().split()]) l = [1] * N for (i, x) in enumerate(X): kouho = [] for (j, y) in enumerate(X[:i]): if x % y == 0: kouho.append(l[j]) if kouho != []: l[i] = max(kouho) + 1 print(max(l))