#include <bits/stdc++.h>
using namespace std;
int s(int n) {
  int r = n % 10;
  while (n /= 10) r += n % 10;
  return r;
}
int main() {
  long long n, c[3] = {0, 0, 0}, ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int u;
    cin >> u;
    u %= 3;
    c[u]++;
  }
  ans += c[0] / 2;
  ans += max(c[1], c[2]) - (max(c[1], c[2]) - min(c[1], c[2]));
  cout << ans << endl;
  return 0;
}
