n = gets.to_i x = gets.split.map(&:to_i).sort c = Array.new(1000001, -1) x.each { |i| c[i] = 1 } x.each { |i| (2*i).step(1000000, i) { |j| c[j] = [c[j], c[i] + 1].max if c[j] >= 0 } } puts c.max