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