#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:60777216")
using namespace std;
int rem[3];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int p;
    scanf("%d", &p);
    int r = 0;
    while (p) {
      r += p % 10;
      p /= 10;
      r %= 3;
    }
    rem[r]++;
  }
  int ans = min(rem[1], rem[2]) + rem[0] / 2;
  printf("%d\n", ans);
  return 0;
}
