#include <bits/stdc++.h>
using namespace std;
int main() {
  long int a;
  int c = 0, d = 0, e = 0, s;
  cin >> a;
  long int b[a];
  for (int i = 0; i < a; i++) {
    cin >> b[i];
    if (b[i] % 3 == 0)
      c++;
    else if (b[i] % 3 == 1)
      d++;
    else
      e++;
  }
  c = c / 2;
  if (d > e)
    s = e;
  else
    s = d;
  cout << s + c;
  return 0;
}
