import math N = int(input()) correct_total = 0 wrong_total = 0 for n in range(N): ts = input().split() t = float(ts[0]) s = ts[1] correct = min( math.floor(12 * t / 1000), len(s) ) correct_total += correct wrong_total += len(s) - correct print(correct_total, wrong_total)