#include <bits/stdc++.h>
using namespace std;
int n, d, res;
int a[200005];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    if (a[i] == 2) d++;
  }
  if (d <= n / 2) {
    res += d;
    n -= 2 * d;
    res += n / 3;
    cout << res;
    return 0;
  } else {
    cout << n - d;
  }
}
