#include <bits/stdc++.h>
using namespace std;
int s[3];
int main() {
  int n, tmp;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int a, b;
    cin >> tmp;
    s[tmp]++;
  }
  cout << min(s[1], s[2]) + max(0, s[1] - s[2]) / 3 << endl;
  return 0;
}
