#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, x, a1 = 0, a2 = 0;
  cin >> n;
  for (i = 1; i <= n; ++i) {
    cin >> x;
    if (x == 1)
      ++a1;
    else
      ++a2;
  }
  int s = 0;
  if (a1 > a2) {
    int n1 = a2 + (a1 - a2) / 3;
    cout << n1;
  } else {
    cout << a1;
  }
  return 0;
}
