#include <bits/stdc++.h>
using namespace std;
int remain[3];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int ai;
    cin >> ai;
    ++remain[ai % 3];
  }
  int fromGroup0 = remain[0] / 2;
  int fromGroup1and2 = (remain[1] < remain[2]) ? remain[1] : remain[2];
  cout << fromGroup0 + fromGroup1and2 << endl;
  return 0;
}
