puts Array.new(gets.to_i) { |i| gets.split }.group_by {|x| x }.to_a.map {|k, v| v[-1] }.tally.to_a.sort {|a, b| a[0] <=> b[0]}.map{|_, v| v}