#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[3] = {0, 0, 0};
  int n;
  string s;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> s;
    int r = 0;
    for (int j = 0; j < s.size(); ++j) r += (s[j] - '0');
    ++a[r % 3];
  }
  int res = min(a[1], a[2]) + (a[0] / 2);
  cout << res;
  return 0;
}
