#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  cin >> n;
  std::vector<int> v1;
  std::map<int, int> m;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x % 3 == 0)
      v1.push_back(x);
    else
      m[x % 3]++;
  }
  x = 0;
  x += v1.size() / 2;
  x += min(m[1], m[2]);
  cout << x;
  return 0;
}
