N = gets.to_i X = gets.split.map(&:to_i).sort M = X.last dp = Array.new(M + 1, 0) ans = 0 X.each do |x| dp[x] = 1 if dp[x] == 0 ans = dp[x] if ans < dp[x] (2 * x).step(M, x) do |i| dp[i] = dp[x] + 1 if dp[i] < dp[x] + 1 end end puts ans