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