#include <bits/stdc++.h>
using namespace std;
int a[10];
int main() {
  int i, j, n, tmp, c1 = 0, c2 = 0;
  memset(a, 0, sizeof(a));
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &tmp);
    a[tmp % 3]++;
  }
  c1 = a[0] / 2;
  c2 = min(a[1], a[2]);
  printf("%d\n", c1 + c2);
  return 0;
}
