#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int cnt1 = 0, cnt2 = 0;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    if (temp == 1)
      cnt1++;
    else
      cnt2++;
  }
  cout << min(cnt2, cnt1) + max((cnt1 - cnt2) / 3, 0) << endl;
}
