#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int A[n];
  bool S[n];
  for (int i = 0; i < n; ++i) {
    cin >> A[i];
    S[i] = true;
  }
  int t = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (S[i] == true && S[j] == true && i != j && (A[i] + A[j]) % 3 == 0) {
        S[i] = false;
        S[j] = false;
        ++t;
      }
    }
  }
  cout << t;
  return 0;
}
