N = int(input()) OKcount = 0 NGcount = 0 for i in range(N): t,s= input().split() t = int(t) s = str(s) can_write = int(t * 12 / 1000) if can_write < len(s): NGcount += len(s) - can_write OKcount += can_write else: OKcount += len(s) print (OKcount,NGcount)