#include <bits/stdc++.h>
int a[2000001];
int main() {
  int n, x = 0, y = 0, sum = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    if (a[i] == 1) {
      x++;
    } else if (a[i] == 2) {
      y++;
    }
  }
  if (x >= y) {
    printf("%d", y + (x - y) / 3);
  } else {
    printf("%d", x);
  }
  return 0;
}
