# -*- 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) type_miss = 0 if len(type_string) <= typed: correct_type += len(type_string) else: type_miss = len(type_string) - typed correct_type += len(type_string) - type_miss typo += type_miss print(correct_type, typo)