#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main()
{
int x = 0;
while (cin >> x)
{
int y;
int count1 = 0,count2=0,count3=0;
string a;
stringstream temp;
for (int i = 0; i < x; i++)
{
cin >> y;
a = a + to_string(y);
}
for (int i = 0; i < a.length(); i++)
{
int num;
temp << a[i];
temp >> num;
if (num % 3 == 0)
{
count1 = count1 + 1;
}
else if (num % 3 == 1)
{
count2 = count2 + 1;
}
else if (num % 3 == 2)
{
count3 = count3 + 1;
}
temp.str("");
temp.clear();
}
cout << count1 << " " << count2 << " " << count3 << endl;
}
}