#coding: utf-8 n=int(raw_input()) turu=0 kame=0 for x in raw_input().split(): num=int(x) if num==2: kame+=1 elif num==4: turu+=1 print turu, kame