#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, int> m;
  int n, tmp;
  cin >> n;
  while (n > 0) {
    cin >> tmp;
    m[tmp % 3]++;
    n--;
  }
  cout << m[0] / 2 + min(m[1], m[2]) << endl;
  return 0;
}
