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