count = 0
for i in range(20):
a = int(input())
if int(str(a)[0]) < int(str(a)[1]):
count += 1
print(count)
count = 0
for i in range(20):
a = int(input())
if int(str(a)[0]) < int(str(a)[1]):
count += 1
print(count)