#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
using std::vector;
vector<int> input(int n) {
  vector<int> result(n);
  for (int i = 0; i < n; ++i) cin >> result[i];
  return result;
}
int count(const vector<int>& numbers, int target) {
  int result = 0;
  for (int i = 0; i < numbers.size(); ++i)
    if (numbers[i] == target) ++result;
  return result;
}
int maxTickets(const vector<int>& pieces) {
  vector<int> residuals(pieces.size());
  for (int i = 0; i < pieces.size(); ++i) residuals[i] = pieces[i] % 3;
  int zero = count(residuals, 0);
  int one = count(residuals, 1);
  int two = count(residuals, 2);
  return std::min(one, two) + zero / 2;
}
int main() {
  int n;
  cin >> n;
  vector<int> pieces = input(n);
  int result = maxTickets(pieces);
  cout << result << endl;
  return 0;
}
