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