n = gets.to_i xs = gets.split.map(&:to_i) if xs.all? {|e| e == xs[0] } if xs[0] == 2 * (xs.size - 1) puts "#{xs.size} 0" else puts "0 #{xs.size}" end exit end ys = xs.map {|e| e + 2 } d = Hash.new(0) ys.each {|e| d[e] += 1 } crane = d[d.keys.max] turtle = n - crane puts "#{crane} #{turtle}"