#include <bits/stdc++.h>
int main() {
  int x = 0, y = 0, z = 0, n, i, p;
  unsigned int in;
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%ud", &in);
    p = in % 3;
    if (p == 2)
      x++;
    else if (p == 1)
      y++;
    else
      z++;
  }
  x = x < y ? x : y;
  z /= 2;
  printf("%d\n", x + z);
  return 0;
}
