n = int(input()) sq = [int(i) for i in input().split()] print(sq.count(4),sq.count(2))