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