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