#include<iostream>
using namespace std;
int main()
{int arr[100],i,x=0,y=0,z=0,n;
cin>>n;
for(i=0;i<n;i++)
cin>>arr[i];
for(i=0;i<n;i++)
{
if(arr[i]==1)
x++;
else if(arr[i]==5)
y++;
else if(arr[i]==10)
z++;}
cout<<x<<endl;
cout<<y<<endl;
cout<<z<<endl;
return 0;
}