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