#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a, c1 = 0, c2 = 0;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a == 1)
      c1++;
    else
      c2++;
  }
  int ans;
  if (c1 >= c2)
    ans = c2 + (c1 - c2) / 3;
  else
    ans = c1;
  cout << ans;
  return 0;
}
