N = int(input()) OK = 0 NG = 0 for _ in range(N): T, S = input().split() X = int(int(T) * 12 / 1000) Y = len(S) OK += [X, Y][X >= Y] NG += max(Y-X, 0) print(OK, NG)