MAX_N = 10 ** 6
X, dp = [0] * (MAX_N+1), [0] * (MAX_N+1)


def main():
    n = int(input())
    x = list(map(int, input().split()))

    for i in x:
        X[i] = 1

    for i in range(MAX_N, 0, -1):
        if X[i]:
            for j in range(1, MAX_N//i+1):
                dp[i] = max(dp[i], dp[j*i]+1)

    print(max(dp))


if __name__ == '__main__':
    main()