#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tests = 1;
  while (tests--) {
    int n;
    cin >> n;
    vector<int> v(n);
    for (long long i = 0; i < n; i++) cin >> v[i];
    int count1 = 0, count2 = 0;
    for (long long i = 0; i < n; i++) {
      if (v[i] == 1) count1++;
      if (v[i] == 2) count2++;
    }
    int ans = 0;
    if (count1 >= count2) {
      ans = (ans) >= ((count2 + (count1 - count2) / 3))
                ? ans
                : (count2 + (count1 - count2) / 3);
    } else {
      ans = (ans) >= ((count1)) ? ans : (count1);
    }
    ans = (ans) >= ((count1 / 3)) ? ans : (count1 / 3);
    cout << ans;
  }
}
