#include<bits/stdc++.h>
using namespace std;
int main(){
int n,x,cnt0=0,cnt1=0,cnt2=0;
cin>>n;
for(int i=0;i<n;i++){
cin>>x;
if(x%3==0)cnt0++;
else if(x%3==1)cnt1++;
else cnt2++;
}
cout<<cnt0<<" "<<cnt1<<" "<<cnt2<<" ";
}