#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int INF = 1e9;
const long long INF64 = 1e18;
const double EPS = 1e-9;
const double PI = acos(-1);
const long long MD = 1951513443;
const long long T = 26;
const int N = 1300100;
const int M = 340;
int n, a[N], sum1[N], sum2[N], sum3[N], sum4[N];
int main() {
  cin >> n;
  for (int i = 0; i < int(n); i++) scanf("%d", &a[i]);
  sort(a, a + n);
  for (int i = n - 1; i >= 0; i--) {
    sum1[i] = sum1[i + 1];
    sum2[i] = sum2[i + 1];
    sum3[i] = sum3[i + 1];
    sum4[i] = sum4[i + 1];
    if (a[i] >= 3) {
      sum1[i] += 4 - a[i];
      sum4[i] += a[i] - 3;
    } else {
      sum2[i] += 3 - a[i];
      sum3[i]++;
    }
  }
  if (sum2[0] == 0) {
    cout << 0;
    return 0;
  }
  int ans = INF, sum = 0;
  if (sum4[0] >= sum2[0]) {
    ans = min(ans, sum2[0]);
  }
  for (int i = 0; i < int(n - 1); i++) {
    sum += a[i];
    int z = sum, aa = 0;
    if (sum2[i + 1] <= z) {
      z -= sum2[i + 1];
      if (z <= sum1[i + 1] + sum3[i + 1]) {
        ans = min(ans, sum);
      }
    } else if (sum2[i + 1] - z <= sum4[i + 1]) {
      aa += sum2[i + 1] - z;
      z += aa;
      if (z - sum2[i + 1] <= sum1[i + 1] + sum3[i + 1] + aa) {
        ans = min(ans, sum + aa);
      }
    }
  }
  if (ans == INF)
    cout << -1;
  else
    cout << ans;
  return 0;
}
