#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int n, m, i, j = 0, count = 0, p, q, a = 0, b = 0, c = 0, d = 0, o,
                         k, e;
  cin >> n;
  long long int ara[n];
  for (i = 0; i < n; i++) {
    cin >> ara[i];
    if (ara[i] % 3 == 1)
      a++;
    else if (ara[i] % 3 == 2)
      b++;
    else
      c++;
  }
  d += c / 2;
  e = min(a, b);
  d += e;
  cout << d;
  return 0;
}
