#include <bits/stdc++.h>
using namespace std;
vector<int> V;
int main() {
  int n;
  scanf("%d", &n);
  V.resize(n);
  for (int i = 0; i < n; ++i) scanf("%d", &V[i]);
  for (int i = 0; i < n; ++i) V[i] = V[i] % 3;
  int res = 0;
  int a = 0, b = 0, c = 0;
  for (int i = 0; i < n; ++i) {
    if (V[i] == 0) a++;
    if (V[i] == 1) b++;
    if (V[i] == 2) c++;
  }
  res = a / 2 + min(b, c);
  printf("%d", res);
  return 0;
}
