#include <bits/stdc++.h>
using namespace std;
int f(int x) {
  int sum = 0;
  while (x > 0) {
    sum += x % 10;
    x = (x - (x % 10)) / 10;
  }
  return sum;
}
int main() {
  int n;
  cin >> n;
  int a = 0, b = 0, c = 0;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    if (f(temp) % 3 == 0) a++;
    if (f(temp) % 3 == 1) b++;
    if (f(temp) % 3 == 2) c++;
  }
  cout << a / 2 + min(c, b);
}
