#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n, ones = 0, two = 0, num;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &num);
    if (num == 1) ones++;
    if (num == 2) two++;
  }
  int ans = min(ones, two);
  ones -= ans;
  if (ones > 0) ans += ones / 3;
  cout << ans << endl;
}
