#include <bits/stdc++.h>
using namespace std;
int sum(int a) {
  int s = 0;
  while (a) {
    s += (a % 10);
    a /= 10;
  }
  return s;
}
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] = sum(a[i]);
  }
  bool f[10001];
  memset(f, false, sizeof(f));
  int count = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if ((f[i] == false && f[j] == false) && (a[i] + a[j]) % 3 == 0) {
        count++;
        f[i] = true;
        f[j] = true;
        break;
      }
    }
  }
  cout << count << endl;
  return 0;
}
