#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ldb = long double;
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
void solve() {
  ll n, x, one = 0, two = 0;
  cin >> n;
  for (int i = (0); i <= (n - 1); ++i) {
    cin >> x;
    if (x == 1)
      one++;
    else
      two++;
  }
  cout << min(one, two) + ((one - min(one, two)) / 3);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}
