#include <bits/stdc++.h>
using namespace std;
int main() {
  int c;
  cin >> c;
  int b = 0;
  int d = 0;
  int f = 0;
  for (int i = 0; i < c; i++) {
    int a;
    cin >> a;
    if (a % 3 == 1) {
      b++;
    }
    if (a % 3 == 2) {
      d++;
    }
    if (a % 3 == 0) {
      f++;
    }
  }
  if (b < d || b == d) {
    cout << b + f / 2 << endl;
  }
  if (b > d) cout << d + f / 2 << endl;
  return 0;
}
