#include <bits/stdc++.h>
using namespace std;
map<long long, long long> m;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]]++;
  }
  long long ctr1 = 0;
  long long x = m[1];
  long long x1 = m[1];
  long long ctr = x / 3;
  if (m[2] != 0) {
    long long y = 1;
    while (x >= y && y <= m[2]) {
      ctr1 = y;
      x1 = x - y;
      ctr1 = ctr1 + x1 / 3;
      y++;
      ctr = max(ctr, ctr1);
    }
  }
  cout << ctr << endl;
  return 0;
}
