#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
int main() {
  int n, x, res = 0, res1 = 0, res2 = 0;
  cin >> n;
  for (int i = 0; i < (n); i++) {
    cin >> x;
    if (x % 3 == 0) res++;
    if (x % 3 == 1) res1++;
    if (x % 3 == 2) res2++;
  }
  cout << (res / 2) + min(res1, res2);
  return 0;
}
