#include <bits/stdc++.h>
using namespace std;
struct str {
  long long val;
  bool b = false;
};
int main() {
  long long n, count = 0;
  cin >> n;
  str *mat;
  mat = new str[n];
  for (long long i = 0; i < n; i++) cin >> mat[i].val;
  for (long long i = n - 1; i > 0; i--)
    for (long long j = n - 2; j >= 0; j--)
      if (!mat[i].b && !mat[j].b)
        if (((mat[i].val + mat[j].val) % 3 == 0) && j != i) {
          count++;
          mat[i].b = true;
          mat[j].b = true;
          break;
        }
  cout << count;
  return 0;
}
