#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
long long n, m = 0, m0 = 0, res = 0, sum = 0, sum0 = 0, maxx = -100000,
             minn = 100000009, coun = 0, coun0, a0 = 0, a1 = 0, a2 = 0, a3 = 0,
             a4 = 0;
long long a[3000009], l[3000009], r[3000009], prom[3000009];
string x, y;
long long nod(long long a, long long b) {
  while (b > 0 && a > 0) {
    a = a % b;
    long long c = a;
    a = b;
    b = c;
  }
  return max(a, b);
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
    if (a[i] == 0) {
      a0++;
    }
    if (a[i] == 1) {
      a1++;
    }
    if (a[i] == 2) {
      a2++;
    }
    if (a[i] == 3) {
      a3++;
    }
    if (a[i] == 4) {
      a4++;
    }
  }
  if (sum == 1 || sum == 2 || sum == 5) {
    cout << "-1" << endl;
  } else {
    int m = min(a1, a2);
    res = m;
    a3 += m;
    a1 -= m;
    a2 -= m;
    if (a1 > 0) {
      res += 2 * (a1 / 3);
      a3 += a1 / 3;
      a1 = a1 % 3;
      if (a1 <= a3) {
        res += a1;
      } else {
        res += 2;
      }
    } else {
      res += 2 * (a2 / 3);
      a3 += 2 * (a2 / 3);
      a2 = a2 % 3;
      if (a2 == 2) {
        res += 2;
      }
      if (a2 == 1) {
        if (a4 != 0)
          res += 1;
        else
          res += 2;
      }
    }
    cout << res << endl;
  }
  int kol234;
  cin >> kol234;
}
