#include <bits/stdc++.h>
int i, j;
using namespace std;
int main() {
  vector<long long> ar;
  long long x;
  long long n, c = 0, k = 0, sum = 0, l = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x;
    ar.push_back(x);
    if (ar[i] == 1)
      c++;
    else if (ar[i] == 2)
      k++;
    else if (ar[i] == 3)
      l++;
  }
  sum += l;
  if (k > c) {
    sum += c;
  } else {
    sum += k;
    c = c - k;
    sum += (c / 3);
  }
  cout << sum << endl;
}
