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