#include <bits/stdc++.h>
using namespace std;
int f(int x) {
  int ans = 0;
  while (x) {
    ans += x % 10;
    x /= 10;
  }
  return ans % 3;
}
int n, H[10], a;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    H[f(a)]++;
  }
  cout << min(H[1], H[2]) + H[0] / 2 << endl;
}
