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