#include <bits/stdc++.h>
using namespace std;
template <class T>
T sqr(T x) {
  return x * x;
}
int main() {
  int n;
  cin >> n;
  int a[10005];
  int b[10005], c[10005];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] % 9 == 0)
      b[i] = 9;
    else
      b[i] = a[i] % 9;
    c[i] = 0;
  }
  int count = 0;
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      int sum = b[i] + b[j];
      if (sum % 3 == 0 && c[i] == 0 && c[j] == 0) {
        ++count;
        c[i] = c[j] = 1;
      }
    }
  }
  cout << count << endl;
  return 0;
}
