#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a = 0;
  string s, str = "";
  vector<string> v;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    v.push_back(s);
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      str = "";
      if (v[j] == "find" || v[i] == "find") continue;
      str = v[i] + v[j];
      long long t = 1, ans = 0;
      ;
      for (int q = str.size() - 1; q >= 0; q--) {
        ans += (str[q] - '0') * t;
        t *= 10;
      }
      if (ans % 3 == 0) {
        a++;
        v[j] = "find";
        break;
      }
    }
  }
  cout << a << endl;
  return 0;
}
