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