#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, k = 0, l = 0;
  cin >> n;
  int ab[n];
  for (i = 0; i < n; i++) {
    cin >> ab[i];
    if (ab[i] == 1)
      k++;
    else
      l++;
  }
  if (k == 0) {
    cout << "0";
    return 0;
  }
  j = min(k, l);
  k = k - j;
  k = k / 3;
  cout << j + k;
}
