#include <bits/stdc++.h>
using namespace std;
long long n;
long long a[500001];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  long long cnt1 = 0, cnt2 = 0;
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == 2)
      cnt2++;
    else
      cnt1++;
  }
  long long v = min(cnt1, cnt2);
  long long rem = n - 2 * v;
  if (v == cnt2) {
    v += (rem / 3);
    cout << v << endl;
  } else {
    cout << v << endl;
  }
  return 0;
}
