n = int(input()) l = list(map(int, input().split())) c = 0 t = 0 for i in l: if i == 2: t += 1 elif i == 4: c += 1 print(c, t)