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