#include <bits/stdc++.h>
using namespace std;
template <typename T>
void $readvec(const vector<T>& vec, int cnt) {
  vec.resize(cnt);
  for (int i = 0; i < cnt; ++i) {
    cin >> vec[i];
  }
}
void $main();
int main() {
  if (0) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  }
  $main();
}
void $main() {
  int n;
  cin >> n;
  int a, b;
  a = b = 0;
  for (int i = 0; i < n; ++i) {
    int t;
    cin >> t;
    if (t == 1) ++a;
    if (t == 2) ++b;
  }
  int ans = 0;
  ans = min(a, b);
  a -= ans;
  b -= ans;
  ans += a / 3;
  cout << ans;
}
