#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const int mod = (int)1e9 + 7;
const double pi = acos(-1.0);
const double eps = 1e-9;
vector<int> a(5, 0);
int n, x;
bool can(int x) {
  if (x == 1 || x == 2 || x == 5) return false;
  return true;
}
int first(vector<int> a) {
  int second = 0;
  for (int i = 0; i < a.size(); i++) second += i * a[i];
  if (!can(second)) return inf;
  if (a[1] == 0 && a[2] == 0) return 0;
  int x = min(a[1], a[2]);
  if (x != 0) {
    a[1] -= x;
    a[2] -= x;
    a[3] += x;
    return x + first(a);
  }
  if (a[1] > 2) {
    int y = a[1] / 3;
    a[1] %= 3;
    a[3] += y;
    return 2 * y + first(a);
  }
  if (a[2] > 2) {
    int y = a[2] / 3;
    a[2] %= 3;
    a[3] += 2 * y;
    return 2 * y + first(a);
  }
  if (a[1] == 0) {
    if (a[4] >= a[2]) return a[2];
    if (a[2] == 1)
      return 2;
    else {
      return 2;
    }
  }
  if (a[2] == 0) {
    if (a[1] <= a[3]) return a[1];
    if (a[1] == 1)
      return 2;
    else if (a[3] == 0)
      return 2;
    else
      return 2;
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    a[x]++;
  }
  int ans = first(a);
  if (ans >= inf) {
    cout << -1;
  } else
    cout << ans;
  return 0;
}
