#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int num1 = 0;
  int num2 = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x == 1) num1++;
    if (x == 2) num2++;
  }
  int ans = min(num2, num1);
  ans += (num1 - min(num2, num1)) / 3;
  cout << ans << '\n';
  return 0;
}
