#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
  int n;
  cin >> n;
  int a[3] = {};
  for (int i = 0; i < n; i++) {
    int c;
    cin >> c;
    a[c % 3]++;
  }
  cout << a[0] / 2 + min(a[1], a[2]) << endl;
  return 0;
}
