#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ones = 0, twos = 0, count = 0;
  cin >> n;
  for (size_t i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (a == 1) {
      ones++;
    }
    if (a == 2) {
      twos++;
    }
  }
  if (ones > twos) {
    cout << twos + (ones - twos) / 3 << endl;
  } else {
    cout << ones << endl;
  }
  return 0;
}
