from collections import Counter N = int(input()) c = Counter(list(map(int, input().split()))) print(str(c[4]) + ' ' + str(c[2]))