from collections import * N = int(input()) A = Counter(map(int, input().split())) print(A[4], A[2])