#include <bits/stdc++.h>
using namespace std;
int arr[5];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  int n, a;
  cin >> n;
  while (n--) {
    cin >> a;
    arr[a]++;
  }
  int ans = 0;
  int tmp = min(arr[1], arr[2]);
  arr[3] += tmp;
  arr[1] -= tmp;
  arr[2] -= tmp;
  ans += tmp;
  if (arr[1]) {
    int tmpans1 = INT_MAX, tmpans2 = INT_MAX, mod;
    tmp = 0;
    bool ok1 = true, ok2 = true;
    for (int i = 0; arr[i] - i * 3 >= 0; i++) {
      tmp = 0;
      bool ok3 = false;
      mod = (arr[1] - i * 3) % 4;
      tmp += ((arr[1] - i * 3) / 4) * 3;
      if (mod == 1 && arr[3])
        tmp++;
      else if (mod == 1 && arr[4] >= 2)
        tmp += 2;
      else if (mod == 2 && arr[4])
        tmp += 2;
      else if (mod == 3)
        tmp += 2;
      else if (mod != 0)
        ok3 = true;
      tmp += (i)*2;
      if (ok3) continue;
      ok2 = false;
      tmpans1 = min(tmpans1, tmp);
    }
    for (int i = 0; arr[i] - i * 4 >= 0; i++) {
      tmp = 0;
      bool ok3 = false;
      mod = (arr[1] - i * 4) % 3;
      tmp += ((arr[1] - i * 4) / 3) * 2;
      if (mod == 1 && arr[3])
        tmp++;
      else if (mod == 1 && arr[4] >= 2)
        tmp += 2;
      else if (mod == 2 && arr[4])
        tmp += 2;
      else if (mod == 2 && arr[3] >= 2)
        tmp += 2;
      else if (mod != 0)
        ok3 = true;
      tmp += (i)*3;
      if (ok3) continue;
      ok1 = false;
      tmpans2 = min(tmpans2, tmp);
    }
    if (ok1 && ok2) {
      puts("-1\n");
      return 0;
    }
    if (ok1)
      ans += tmpans1;
    else if (ok2)
      ans += tmpans2;
    else
      ans += min(tmpans2, tmpans1);
  } else if (arr[2]) {
    tmp = 0;
    int tmpans = INT_MAX;
    bool ok = false;
    for (int i = 0; i <= arr[2]; i++) {
      tmp = 0;
      int twos = arr[2];
      if (i * 2 >= twos - i) {
        tmp += twos - i;
        int diff = i * 2 - (twos - i);
        if (diff / 2 == 1 && arr[3] >= 2)
          tmp += 2;
        else if (diff / 2 == 1)
          continue;
        else
          tmp += diff / 2 + diff % 2;
      } else {
        tmp += i * 2;
        int diff = (twos - i) - i * 2;
        tmp += min(diff, arr[4]);
        diff -= min(diff, arr[4]);
        if (diff == 1 && arr[3] >= 2)
          tmp += 2;
        else if (diff == 1)
          continue;
        else
          tmp += (diff / 2) * 2 + diff % 2;
      }
      ok = true;
      tmpans = min(tmp, tmpans);
    }
    if (!ok) {
      cout << -1;
      return 0;
    }
    ans += tmpans;
  }
  cout << ans << '\n';
}
