#29972: python不用if(四行解)


422596@st.tc.edu.tw (殤)


A=[0,0,0]

for a in range(int(input())):

    A[int(input())%3]+=1

print(A[0],A[1],A[2])