#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long n;
  cin >> n;
  long c1 = 0, c2 = 0;
  int c;
  for (long i = 0; i < n; i++) {
    cin >> c;
    if (c == 1)
      c1++;
    else
      c2++;
  }
  long count = 0;
  if (c2 <= c1) {
    count += c2;
    c1 -= c2;
    count += (c1 / 3);
  } else {
    count += c1;
  }
  cout << count << endl;
  return 0;
}
