N = gets.to_i x = gets.split.map(&:to_i) m = x.max dp = Array.new(m + 1, 1) x.sort.each do |a| (2 * a).step(m, a) do |b| dp[b] = [dp[b], dp[a] + 1].max end end ans = x.map {|a| dp[a]}.max puts ans