# -*- coding: utf-8 -*- N = int(input()) correct_type = 0 typo = 0 for i in range(N): time, type_string = input().split() typed = int(12 * int(time) / 1000) if len(type_string) <= typed: correct_type += len(type_string) else: typo = len(type_string) - typed correct_type += len(type_string) - typo print(correct_type, typo)