#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, x, m, n, y, q, p, cnt = 0, ans = 0, sum = 0, mx = 0,
                                    mn = 1e18;
  cin >> a;
  while (a--) {
    cin >> y;
    if (y == 2) cnt++;
    if (y == 1) ans++;
  }
  while (1) {
    if (cnt >= 1 && ans >= 1) {
      sum++;
      ans--;
      cnt--;
    } else if (ans >= 3) {
      sum++;
      ans -= 3;
    }
    if (ans < 3 && cnt == 0 || ans == 0) break;
  }
  cout << sum;
}
