#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4 + 5;
int a[maxn];
int sum1, sum2, sum3;
void p(int a) {
  int ans = 0;
  while (a != 0) {
    ans += a % 10;
    ans %= 3;
    a /= 10;
  }
  ans %= 3;
  if (ans == 1) {
    sum1++;
  }
  if (ans == 2) {
    sum2++;
  }
  if (ans == 0) {
    sum3++;
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    p(a[i]);
  }
  cout << min(sum1, sum2) + sum3 / 2;
}
