#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, ones = 0, twos = 0, zeros = 0;
  scanf("%d", &n);
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    v[i] = x % 3;
    if (v[i] == 1)
      ones++;
    else if (v[i] == 2)
      twos++;
    else
      zeros++;
  }
  int res = min(ones, twos) + zeros / 2;
  printf("%d", res);
}
