N = gets.to_i X = gets.split.map(&:to_i).sort M = X.last dp = Array.new(M + 1, 0) dp[X.first] = 1 ans = 0 X.each do |x| 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