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