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