#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i;
  cin >> n;
  int a[n];
  int c1 = 0, c2 = 0;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == 1)
      c1++;
    else
      c2++;
  }
  int count;
  if (c2 > c1)
    count = c1;
  else
    count = c2 + (c1 - c2) / 3;
  cout << count << endl;
  return 0;
}
