#include <bits/stdc++.h>
using namespace std;
const int max_n = 1, inf = 1e9 + 100;
int n, c0, c1, c2, c3, c4;
int main() {
  int n;
  cin >> n;
  int sum = 0;
  for (int i = 0; i < n; ++i) {
    int a;
    scanf("%d", &a);
    if (a == 0) ++c0;
    if (a == 1) ++c1;
    if (a == 2) ++c2;
    if (a == 3) ++c3;
    if (a == 4) ++c4;
  }
  sum = c1 + c2 * 2 + c3 * 3 + c4 * 4;
  if (sum == 1 || sum == 2 || sum == 5) {
    cout << -1;
    return 0;
  }
  int ans = 0;
  if (c2 > c1) {
    c3 += c1;
    c2 -= c1;
    ans += c1;
    c1 = 0;
    ans += (c2 / 3) * 2;
    c3 += (c2 / 3) * 2;
    c2 %= 3;
    if (c2 == 2) {
      ++c4;
      c2 = 0;
      ans += 2;
    } else if (c2 == 1) {
      if (c4 > 0) {
        ++ans;
        --c4;
        ++c3;
        c2 = 0;
      } else {
        ans += 2;
        c3 -= 2;
        c4 += 2;
        c2 = 0;
      }
    }
  } else {
    c3 += c2;
    c1 -= c2;
    ans += c2;
    c2 = 0;
    ans += (c1 / 3) * 2;
    c3 += (c1 / 3);
    c1 %= 3;
    if (c1 == 1) {
      if (c3 > 0) {
        ++ans;
        --c3;
        ++c4;
        c1 = 0;
      } else {
        ans += 2;
        c4 -= 2;
        c3 += 2;
        c1 = 0;
      }
    } else if (c1 == 2) {
      if (c4 > 0) {
        --c4;
        c3 += 2;
        ans += 2;
        c1 = 0;
      } else {
        ans += 2;
        c3 -= 2;
        c4 += 2;
        c1 = 0;
      }
    }
  }
  cout << ans;
  return 0;
}
