#include <bits/stdc++.h>
using namespace std;
const long double pi = 4 * atan((long double)1);
const long long mod = 1e9 + 7;
const long long inf = 922337203685477;
const long long nax = 0;
long long one, two, n, a;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a;
    if (a == 1) {
      one++;
    } else {
      two++;
    }
  }
  long long mini = min(one, two);
  long long ans = mini;
  one -= mini, two -= mini;
  ans += one / 3;
  cout << ans << '\n';
}
