#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, n, a[10002], count1, count2, count, temp;
  while (cin >> n) {
    count = 0, count1 = 0, count2 = 0;
    for (i = 0; i < n; i++) {
      cin >> a[i];
      if (a[i] % 3 == 0)
        count++;
      else if (a[i] % 3 == 1)
        count1++;
      else if (a[i] % 3 == 2)
        count2++;
    }
    temp = count1 < count2 ? count1 : count2;
    count = count / 2 + temp;
    cout << count << endl;
  }
  return 0;
}
