N = gets.to_i A = N.times.map { gets.to_i }.sort C = Array.new(N, -Float::INFINITY) A.each do |a| N.times do |i| c = C[i] if c + 1 < a C[i] = a break end end end puts C.count { |c| c != -Float::INFINITY }