#include <bits/stdc++.h>
using namespace std;
map<int, bool> mark;
int numdigits(long long x) {
  int c = 0;
  while (x != 0) {
    x /= 10;
    c++;
  }
  return c;
}
long long powten(int c) {
  int ans = 10;
  for (int i = 0; i < c - 1; i++) {
    ans *= 10;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  vector<long long> x;
  int temp;
  int digit;
  int ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    x.push_back(temp);
  }
  for (int i = 0; i < n; i++) {
    if (mark[i] != 1)
      for (int j = i + 1; j < n; j++) {
        digit = numdigits(x[j]);
        if ((x[i] * powten(digit) + x[j]) % 3 == 0 && mark[j] != 1) {
          ans++;
          mark[i] = 1;
          mark[j] = 1;
          break;
        }
      }
  }
  cout << ans;
}
