#include <bits/stdc++.h>
using namespace std;
const int N = 1000006;
int n;
int x[N];
int c[5];
int Solve() {
  int ret = 0;
  for (int i = 1; i <= n; i++) {
    cin >> x[i];
    c[x[i]]++;
  }
  if (c[1] == c[2] && c[1] == 0) return 0;
  int m = min(c[1], c[2]);
  c[1] -= m;
  c[2] -= m;
  c[3] += m;
  ret = m;
  if (c[1] >= 3) {
    int v = (c[1] / 3);
    ret += 2 * v;
    c[3] += v;
    c[1] %= 3;
  }
  if (c[2] >= 3) {
    int v = (c[2] / 3);
    ret += 2 * v;
    c[3] += 2 * v;
    c[2] %= 3;
  }
  if (c[2] == 2) {
    c[4]++;
    ret += 2;
    c[2] = 0;
  }
  if (c[2] == 1) {
    if (c[1] == 0) {
      if (c[4] > 0)
        return (ret + 1);
      else if (c[3] > 1)
        return (ret + 2);
      else
        return -1;
    } else if (c[1] == 1) {
      return (ret + 1);
    } else if (c[1] == 2) {
      return (ret + 2);
    }
  } else if (c[2] == 0) {
    if (c[1] == 0)
      return ret;
    else if (c[1] == 1) {
      if (c[3] > 0)
        return (ret + 1);
      else if (c[4] > 1)
        return (ret + 2);
      else
        return -1;
    } else if (c[1] == 2) {
      if (c[4] > 0 || c[3] > 1)
        return (ret + 2);
      else
        return -1;
    }
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  cout << Solve() << '\n';
  return 0;
}
