#include <bits/stdc++.h>
using namespace std;
int main() {
  long n;
  cin >> n;
  long long a[n];
  long c[3];
  c[0] = c[1] = c[2] = 0;
  for (long i = 0; i < n; i++) {
    cin >> a[i];
    c[a[i] % 3]++;
  }
  cout << min(c[1], c[2]) + c[0] / 2;
  return 0;
}
