#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, cat1 = 0, cat2 = 0, cat0 = 0, tmp;
  cin >> n;
  while (n--) {
    cin >> tmp;
    if (tmp % 3 == 0)
      cat0++;
    else if (tmp % 3 == 1)
      cat1++;
    else
      cat2++;
  }
  cout << cat0 / 2 + min(cat1, cat2) << "\n";
  return 0;
}
