#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  t = 1;
  while (t--) {
    long long int n, c1 = 0, c2 = 0, x;
    cin >> n;
    while (n--) {
      cin >> x;
      if (x == 1)
        c1++;
      else
        c2++;
    }
    x = min(c1, c2);
    c1 -= x;
    c2 -= x;
    cout << x + (c1 / 3);
  }
  return 0;
}
