N=int(input()) ok=0 ng=0 for _ in range(N): T,S=input().split() T=int(T) tmp=(12*T)//1000 ok+=min(len(S),tmp) ng+=max(0,len(S)-tmp) print(ok,ng)