#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
set<char> se;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  int a1, a2;
  a1 = a2 = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    if (x == 1)
      a1++;
    else
      a2++;
  }
  if (a1 <= a2)
    cout << a1 << endl;
  else
    cout << a2 + (a1 - a2) / 3 << endl;
  return 0;
}
