#include <bits/stdc++.h>
using namespace std;
int res0, res1, res2;
int n, a;
inline int sum(int num) {
  int res = 0;
  while (num > 0) {
    res += (num % 10);
    num /= 10;
  }
  return res % 3;
}
int main() {
  cin >> n;
  while (n--) {
    cin >> a;
    a = sum(a);
    if (a == 0)
      res0++;
    else if (a == 1)
      res1++;
    else
      res2++;
  }
  cout << (res0 / 2) + min(res1, res2) << endl;
  return 0;
}
