#include <bits/stdc++.h>
int main() {
  long N;
  long long unsigned NUMEROS[10000];
  long i;
  int CONT_RESTOS[3] = {0, 0, 0};
  int AUX_RESTO;
  int MIN;
  int RESTO_ZERO;
  while (scanf("%d", &N) != EOF) {
    CONT_RESTOS[0] = 0;
    CONT_RESTOS[1] = 0;
    CONT_RESTOS[2] = 0;
    for (i = 0; i < N; i++) {
      scanf("%I64d", &NUMEROS[i]);
      AUX_RESTO = NUMEROS[i] % 3;
      if (AUX_RESTO == 0)
        CONT_RESTOS[0]++;
      else if (AUX_RESTO == 1)
        CONT_RESTOS[1]++;
      else if (AUX_RESTO == 2)
        CONT_RESTOS[2]++;
    }
    MIN = CONT_RESTOS[1];
    if (MIN > CONT_RESTOS[2]) MIN = CONT_RESTOS[2];
    RESTO_ZERO = int(CONT_RESTOS[0] / 2);
    printf("%d", MIN + RESTO_ZERO);
  }
  return 0;
}
