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