a = list(map(int, input().split()))
chetn = len([i for i in a if i % 2 == 0])
print(chetn)
end_5 = len([i for i in a if str(i)[len(str(i))-1] == 5])
print(end_5)
a = list(map(int, input().split()))
chetn = len([i for i in a if i % 2 == 0])
print(chetn)
end_5 = len([i for i in a if str(i)[len(str(i))-1] == 5])
print(end_5)