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