#include <bits/stdc++.h>
using namespace std;
int num[20000];
int qtd;
int main() {
  scanf("%d", &qtd);
  for (int i = 0; i < qtd; ++i) {
    scanf("%d", num + i);
    num[i] = num[i] % 3;
  }
  sort(num, num + qtd);
  int qtd0 = 0, qtd1 = 0, qtd2 = 0;
  int i;
  for (i = 0; i < qtd; ++i) {
    if (num[i] == 0)
      ++qtd0;
    else
      break;
  }
  for (; i < qtd; ++i) {
    if (num[i] == 1)
      ++qtd1;
    else
      break;
  }
  for (; i < qtd; ++i) {
    if (num[i] == 2)
      ++qtd2;
    else
      break;
  }
  cout << (min(qtd1, qtd2) + qtd0 / 2) << endl;
}
