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