#include <bits/stdc++.h>
using namespace std;
int a[110], b1, b2, b3;
int main() {
  int t, n, sum;
  cin >> t;
  while (t--) {
    b1 = b2 = b3 = 0;
    sum = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      if (a[i] % 3 == 1)
        b1++;
      else if (a[i] % 3 == 2)
        b2++;
      else if (a[i] % 3 == 0)
        b3++;
    }
    if (b2 < b1)
      sum = b2 + (b1 - b2) / 3 + b3;
    else if (b1 < b2)
      sum = b1 + b3 + (b2 - b1) / 3;
    else
      sum = b1 + b3;
    cout << sum << endl;
  }
  return 0;
}
