#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const long double pi = 3.14159265358979323846;
const long long int inf = (long long int)1ll << 50;
const int ss = (int)1e6 + 3;
const long long int base = inf;
bool pred(const pair<int, int>& i, const pair<int, int>& j) {
  if (i.first == j.first) {
    return i.second > j.second;
  } else {
    return i.first > j.first;
  }
}
bool pred1(const string& i, const string& j) { return i.size() > j.size(); }
int main() {
  int n;
  cin >> n;
  vector<int> a(5);
  int sum = 0;
  for (int i = 0; i < n; ++i) {
    int z;
    scanf("%d", &z);
    a[z]++;
    sum += z;
  }
  if (sum <= 2 || sum == 5) {
    cout << -1;
    return 0;
  }
  int res = 0;
  int now = min(a[1], a[2]);
  res += now;
  a[1] -= now;
  a[2] -= now;
  a[3] += now;
  now = a[1] / 3;
  res += now * 2;
  a[3] += now;
  a[1] %= 3;
  now = a[2] / 3;
  res += now * 2;
  a[3] += now * 2;
  a[2] %= 3;
  if (a[1] != 0) {
    if (a[1] == 1) {
      if (a[3] != 0) {
        res++;
      } else {
        res += 2;
      }
    } else {
      res += 2;
    }
  }
  if (a[2] != 0) {
    if (a[2] == 1) {
      if (a[4] != 0) {
        res++;
      } else {
        res += 2;
      }
    } else {
      res += 2;
    }
  }
  cout << res;
  return 0;
}
