#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, k, c, x, t, a, b, amt[1000001], res;
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x;
    amt[x]++;
  }
  a = min(amt[1], amt[2]);
  b = amt[1] - amt[2];
  if (b > 0)
    res = a + (b / 3);
  else
    res = a;
  cout << res << endl;
  return 0;
}
