N = int(raw_input()) miss_total = 0 total = 0 for _ in xrange(N): T, S = raw_input().split() total += len(S) current_miss = len(S) - (12 * int(T) // 1000) miss_total += max(current_miss, 0) print total - miss_total, miss_total