#include <bits/stdc++.h>
using namespace std;
bool comp(int a, int b) { return a > b; }
int change(string num) {
  int sum = 0, l = num.length();
  for (int i = 0; i < l; i++) {
    sum += (int)num[i] - 48;
  }
  return sum;
}
int main() {
  int n;
  cin >> n;
  int sum3 = 0, sum1 = 0, sum2 = 0;
  for (int i = 0; i < n; i++) {
    string num;
    cin >> num;
    switch (change(num) % 3) {
      case 0: {
        sum3++;
        break;
      }
      case 1: {
        sum1++;
        break;
      }
      case 2: {
        sum2++;
        break;
      }
    }
  }
  sum3 /= 2;
  sum3 += min(sum2, sum1);
  cout << sum3 << endl;
  return 0;
}
