#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int x, cnta = 0, cntb = 0;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (x == 2)
      cnta++;
    else
      cntb++;
  }
  if (cnta < cntb) {
    cout << max(cnta + ((cntb - cnta) / 3), cntb / 3);
  } else {
    cout << cntb;
  }
}
