#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, temp;
  cin >> n;
  vector<int> num;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    num.push_back(temp);
  }
  vector<int> sum;
  vector<int>::iterator itr;
  for (itr = num.begin(); itr < num.end(); itr++) {
    int m = *itr, s = 0;
    while (m > 0) {
      s += m % 10;
      m /= 10;
    }
    sum.push_back(s);
  }
  int diff[3] = {0};
  for (itr = sum.begin(); itr < sum.end(); itr++) diff[*itr % 3]++;
  int maxc = 0;
  if (diff[1] < diff[2])
    maxc += diff[1];
  else
    maxc += diff[2];
  maxc += diff[0] / 2;
  cout << maxc << endl;
  return 0;
}
