import sys def input(): return sys.stdin.readline().rstrip() def main(): input() # N *A, = map(int, input().split()) print(A.count(4), A.count(2)) if __name__ == '__main__': main()