N = int(input()) A = list(map(int, input().split())) ans = [0]*2 for a in A: if a == 4: ans[0] += 1 else: ans[1] += 1 print(*ans)