#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, n, r = 0, s = 0;
  int a[5];
  cin >> n;
  for (i = 0; i < 5; ++i) a[i] = 0;
  for (i = 0; i < n; ++i) {
    cin >> j;
    a[j]++;
    s += j;
  }
  if ((s < 3) || (s == 5)) {
    cout << -1 << endl;
    return 0;
  }
  if (a[1] >= a[2]) {
    r += a[2];
    a[1] = a[1] - a[2];
    a[3] += a[2];
    a[2] = 0;
    j = a[1] / 3;
    r += j * 2;
    a[1] = a[1] % 3;
    a[3] += j;
    if (a[3] >= a[1]) {
      r += a[1];
      a[4] += a[1];
      a[3] = a[3] - a[1];
      a[1] = 0;
    } else if (a[1] == 2) {
      if (a[4] > 0) {
        r += 2;
        a[1] = 0;
        a[4]--;
        a[3]++;
      } else {
        cout << -1 << endl;
        return 0;
      }
    } else {
      if (a[4] > 1) {
        r += 2;
        a[1] = 0;
        a[4] = a[4] - 2;
        a[3]++;
      } else {
        cout << -1 << endl;
        return 0;
      }
    }
  } else {
    r += a[1];
    a[3] += a[1];
    a[2] = a[2] - a[1];
    a[1] = 0;
    j = a[2] / 3;
    r += j * 2;
    a[2] = a[2] % 3;
    a[3] += j * 2;
    if (a[4] >= a[2]) {
      r += a[2];
      a[3] += a[2] * 2;
      a[4] = a[4] - a[2];
      a[2] = 0;
    } else if (a[2] == 2) {
      r += 2;
      a[2] = 0;
      a[4]++;
    } else {
      if (a[3] > 1) {
        r += 2;
        a[2] = 0;
        a[3] = a[3] - 2;
        a[4] += 2;
      } else {
        cout << -1 << endl;
        return 0;
      }
    }
  }
  cout << r << endl;
  return 0;
}
