#include <bits/stdc++.h>
using namespace std;
bool check(string a, string b) {
  string s = a + b;
  if (atoll(&s[0]) % 3 == 0) return true;
  s = b + a;
  return atoll(&s[0]) % 3 == 0;
}
int main(void) {
  int n;
  cin >> n;
  vector<string> v;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    bool flg = true;
    for (int j = 0; j < v.size(); j++) {
      if (check(v[j], s)) {
        v.erase(v.begin() + j);
        ans++;
        flg = false;
        break;
      }
    }
    if (flg) v.push_back(s);
  }
  cout << ans << endl;
  return 0;
}
