#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    v.push_back(temp);
  }
  sort(v.begin(), v.end());
  map<int, int> m;
  m[1] = 0;
  m[2] = 0;
  for (int i : v) {
    m[i]++;
  }
  int one = m[1];
  int two = m[2];
  int count = 0;
  while (one && two) {
    if (two > 0 && one > 0) {
      two--;
      one--;
      count++;
    }
  }
  if (one < 3) {
    cout << count;
  } else {
    one /= 3;
    cout << count + one;
  }
}
