#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > v;
long long pos[10004];
int main() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    long long x = a[i], c = 0;
    while (x) {
      x /= 10;
      c++;
    }
    v.push_back(make_pair(a[i], c));
  }
  long long cont = 0;
  for (int i = 0; i < n; i++) {
    long long x = a[i];
    if (pos[i] != 1)
      for (int j = i + 1; j < n; j++) {
        x = a[i];
        if (pos[j] != 1) {
          x *= powl(10, v[j].second);
          x += v[j].first;
          if (x % 3 == 0) {
            pos[i] = 1;
            pos[j] = 1;
            cont++;
            break;
          }
        }
      }
  }
  cout << cont << endl;
  return 0;
}
