#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, one = 0, two = 0, total = 0, rest = 0;
  cin >> n;
  int a;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a == 1)
      one++;
    else
      two++;
  }
  rest = two - one;
  if (rest == 0)
    total = one;
  else if (rest < 0) {
    total += two;
    if (one - total >= 3) total += ((one - total) - ((one - total) % 3)) / 3;
  } else
    total = one;
  cout << total << endl;
}
