#include <bits/stdc++.h>
using namespace std;
int main() {
  int c1 = 0, c2 = 0, c3 = 0;
  int t;
  cin >> t;
  while (t--) {
    int x;
    cin >> x;
    if (x == 1)
      c1++;
    else if (x == 2)
      c2++;
  }
  c3 = min(c1, c2);
  c1 -= c3;
  cout << c3 + c1 / 3 << endl;
  return 0;
}
