#include <bits/stdc++.h>
using namespace std;
int main() {
  int A[3] = {0};
  int num;
  cin >> num;
  long ip;
  while (num--) {
    cin >> ip;
    if (ip % 3 == 0)
      A[0]++;
    else if (ip % 3 == 1)
      A[1]++;
    else if (ip % 3 == 2)
      A[2]++;
  }
  cout << A[0] / 2 + min(A[1], A[2]);
  return 0;
}
