#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[5];
  memset(a, 0, sizeof(a));
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int cur;
    cin >> cur;
    a[cur % 3]++;
  }
  cout << a[0] / 2 + min(a[1], a[2]);
  return 0;
}
