#include <bits/stdc++.h>
using namespace std;
int main() {
  long long team, x, total = 0, total1 = 0, total2 = 0;
  cin >> team;
  for (int i = 1; i <= team; i++) {
    cin >> x;
    if (x == 1)
      total1++;
    else
      total2++;
  }
  int minimal = total1;
  if (minimal == 0) {
    cout << 0 << endl;
    return 0;
  }
  if (total1 > total2)
    cout << total2 + ((total1 - total2) / 3) << endl;
  else
    cout << total1 << endl;
}
