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