#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e7 + 7;
inline long long pw(long long a, long long n) {
  if (!n)
    return 1;
  else if (n & 1)
    return pw(a, --n) * a % mod;
  else {
    long long b = pw(a, n / 2) % mod;
    return (b % mod * b % mod) % mod;
  }
}
inline long long read() {
  long long s = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = (s << 1) + (s << 3) + ch - '0';
    ch = getchar();
  }
  return s * f;
}
const long long M = 1e5 + 20;
const long long inf = 1e18;
long long n = read(), a;
list<long long> ls;
signed main() {
  for (long long i = 0; i < n; i++) {
    cin >> a;
    ls.emplace_back(a);
  }
  cout << (count((ls).begin(), (ls).end(), 1) <
                   count((ls).begin(), (ls).end(), 2)
               ? count((ls).begin(), (ls).end(), 1)
               : count((ls).begin(), (ls).end(), 2) +
                     (count((ls).begin(), (ls).end(), 1) -
                      count((ls).begin(), (ls).end(), 2)) /
                         3);
}
