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