#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> g1, g2;
  for (int i = 0; i < n; ++i) {
    int val;
    scanf("%d", &val);
    if (val == 1)
      g1.push_back(1);
    else
      g2.push_back(2);
  }
  int ans = 0;
  while (g1.size() || g2.size()) {
    if (g1.size() > 0 && g2.size() > 0) {
      ++ans;
      g1.pop_back();
      g2.pop_back();
      continue;
    }
    if (g1.size() == 0) {
      g2.pop_back();
      continue;
    }
    if (g1.size() >= 3) {
      g1.pop_back();
      g1.pop_back();
      g1.pop_back();
      ++ans;
    } else {
      g1.pop_back();
    }
  }
  cout << ans << endl;
}
