#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  int mod[3] = {0};
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    mod[a % 3]++;
  }
  cout << mod[0] / 2 + min(mod[1], mod[2]) << endl;
  return 0;
}
