#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = LLONG_MAX;
int main() {
  long long n, x = 0, y = 0, z;
  cin >> n;
  int a[n];
  for (long long i = 0; i < (long long)n; i++) cin >> a[i];
  for (long long i = 0; i < (long long)n; i++) {
    if (a[i] == 1)
      x++;
    else
      y++;
  }
  z = min(x, y);
  if (z == y) {
    z += (x - y) / 3;
  }
  cout << z;
  return 0;
}
