#include <bits/stdc++.h>
using namespace std;
int n;
int a[10001];
bool id[10001];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    id[i] = true;
  }
  int kq = 0;
  for (int i = 1; i <= n; i++)
    if (id[i])
      for (int j = i + 1; j <= n; j++)
        if ((id[j]) &&
            ((a[i] % 3 + a[j] % 3 == 0) || (a[i] % 3 + a[j] % 3 == 3))) {
          kq++;
          id[i] = false;
          id[j] = false;
          break;
        }
  cout << kq;
}
