#include <bits/stdc++.h>
int main() {
  int a, b;
  int n;
  scanf("%d", &n);
  a = b = 0;
  for (int i = 1; i <= n; i++) {
    int k;
    scanf("%d", &k);
    if (k == 1)
      a++;
    else
      b++;
  }
  if (a == 0 || b == 0 && a <= 2)
    printf("0\n");
  else {
    if (a >= b)
      printf("%d\n", b + (a - b) / 3);
    else
      printf("%d\n", a);
  }
  return 0;
}
