#include <bits/stdc++.h>
using namespace std;
struct _ {
  ios_base::Init i;
  _() {
    cin.sync_with_stdio(0);
    cin.tie(0);
  }
} _;
int main() {
  int n;
  cin >> n;
  int sizes[2] = {};
  for (int i = 0; i < n; ++i) {
    int size;
    cin >> size;
    ++sizes[size - 1];
  }
  int ans = min(sizes[0], sizes[1]);
  sizes[0] -= ans;
  ans += sizes[0] / 3;
  cout << ans;
  return 0;
}
