#region Header #!/usr/bin/env python3 # from typing import * import sys import io import math import collections import decimal import itertools from queue import PriorityQueue import bisect import heapq def input(): return sys.stdin.readline()[:-1] sys.setrecursionlimit(1000000) #endregion # _INPUT = """7 # 1 2 22 88 8 4 440 # """ # sys.stdin = io.StringIO(_INPUT) def main(): N = int(input()) X = sorted(list(map(int, input().split()))) dp = [0 for _ in range(N)] dp[0] = 1 for i in range(N-1): for j in range(i+1, N): if X[j] % X[i] == 0: dp[j] = max(dp[j], dp[i] + 1) else: dp[j] = max(dp[j], dp[i]) print(dp[N-1]) if __name__ == '__main__': main()