#!/usr/bin/python # -*- coding: utf-8 -*- N = int(raw_input()) tmp,arys = [],[] ans = 0 for i in xrange(N): ini = map(int, raw_input().split()) tmp.extend(ini) tmp.sort() for i in xrange(1,11): arys.append(tmp.count(i)) arys.sort(reverse=True) for (i,val) in enumerate(arys): print i , val ans += val / 2 if val % 2 == 1: val = 1 else: val = 0 print ans + arys.count(1) / 4