#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int t, p, q;
  p = q = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> t;
    if (t == 1)
      p++;
    else
      q++;
  }
  if (p > q)
    cout << q + (p - q) / 3;
  else
    cout << p;
  return 0;
}
