#include <bits/stdc++.h>
using namespace std;
long long ar[10009], vis[19];
int main() {
  long long n;
  cin >> n;
  long long k, cnt = 0;
  long long j = 0;
  long long one = 0, two = 0;
  for (long long i = 1; i <= n; i++) {
    cin >> k;
    if (k % 3 == 0)
      cnt++;
    else {
      long long r = k % 3;
      if (r == 1)
        one++;
      else
        two++;
    }
  }
  long long ans = (cnt / 2) + min(one, two);
  cout << ans << endl;
  return 0;
}
