#include <bits/stdc++.h>
using namespace std;
const int cupe = 5;
int main() {
  int n, a[cupe], sum = 0, ans = 0;
  cin >> n;
  for (int i = 1; i < 5; ++i) a[i] = 0;
  for (int i = 0; i < n; ++i) {
    int temp;
    cin >> temp;
    sum += temp;
    ++a[temp];
  }
  if (sum == 1 || sum == 2 || sum == 5) {
    cout << -1;
    return 0;
  } else {
    while (a[1] > 0 || a[2] > 0) {
      if (a[2] > 0) {
        if (a[1] > 0) {
          int x = a[2];
          int y = a[1];
          if (y >= x) {
            a[2] = 0;
            a[3] += x;
            a[1] -= x;
            ans += x;
          } else {
            a[2] -= y;
            a[1] = 0;
            a[3] += y;
            ans += y;
          }
        } else {
          if (a[2] >= 3) {
            int k = a[2] / 3;
            a[3] += 2 * k;
            a[2] -= 3 * k;
            ans += 2 * k;
          } else {
            if (a[2] == 2) {
              a[2] = 0;
              ans += 2;
              a[4]++;
            }
            if (a[2] == 1 && a[4] > 0) {
              ans += 1;
              a[2] = 0;
              a[4]--;
            }
            if (a[2] == 1 && a[4] == 0) {
              a[2] = 0;
              ans += 2;
            }
          }
        }
      } else {
        if (a[1] >= 3) {
          int k = a[1] / 3;
          a[3] += 2 * k;
          a[1] -= 3 * k;
          ans += 2 * k;
        } else {
          if (a[1] == 2) {
            ans += a[1];
            a[1] = 0;
          } else {
            if (a[3] > 0) {
              a[1] = 0;
              ans++;
            } else {
              a[1] = 0;
              ans += 2;
            }
          }
        }
      }
    }
  }
  cout << ans;
  return 0;
}
