#include <bits/stdc++.h>
using namespace std;
int N, X, A[3];
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &X);
    A[X % 3]++;
  }
  printf("%d", A[0] / 2 + min(A[1], A[2]));
  return 0;
}
