#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  vector<long long int> input(n);
  long long int cnt1, cnt2;
  cnt1 = cnt2 = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> input[i];
    if (input[i] == 1) {
      cnt1++;
    } else {
      cnt2++;
    }
  }
  long long int ans;
  if (cnt1 > cnt2) {
    ans = cnt2 + (cnt1 - cnt2) / 3;
  }
  if (cnt1 < cnt2) {
    ans = cnt1;
  }
  if (cnt1 == cnt2) {
    ans = cnt2;
  }
  cout << ans << endl;
  return 0;
}
