#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int resto[3];
  memset(resto, 0, sizeof(resto));
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int ticket;
    cin >> ticket;
    int sum = 0;
    while (ticket) {
      sum += ticket % 10;
      ticket /= 10;
    }
    sum %= 3;
    resto[sum]++;
  }
  cout << resto[0] / 2 + min(resto[1], resto[2]);
  return 0;
}
