#include <bits/stdc++.h>
using namespace std;
int a[10005], b[10005], c[10005], mo[10005];
char S[10005], SS[10005], AA[10005], xx[10005], yy[10005];
char BB[10001][101];
map<int, int> mp;
map<long long, int> mp1;
int main() {
  int i, j, k, n, t, m, y, cnt, adigit, bdigit;
  while (scanf("%d", &n) == 1) {
    for (i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      mo[a[i] % 3]++;
    }
    k = mo[0] / 2 + min(mo[1], mo[2]);
    printf("%d\n", k);
  }
  return 0;
}
