#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int tc;     cin >> tc;     int z;     for (int t = 1; t <= tc; t++) {       cin >> z;       int a, s, d = 0;       s = 0;       a = 0;       int x;       for (int q = 1; q <= z; q++) {         cin >> x;         if (x % 3 == 0)           a++;         else if (x % 3 == 1)           s++;         else           d++;       }       int total = a + (min(s, d));       int temp = min(s, d);       s -= temp;       d -= temp;       total += (s / 3);       total += (d / 3);       cout << total << endl;     }   }   