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