#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k = 0;
  int m[10006];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> m[i];
    m[i] %= 3;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i != j && m[i] >= 0 && m[j] >= 0 && (m[i] + m[j]) % 3 == 0) {
        k++;
        m[i] = m[j] = -1;
      }
    }
  }
  cout << k;
  return 0;
}
