#include <bits/stdc++.h>
using namespace std;
int A[1000010];
int cnts[5];
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
    cnts[A[i]] += 1;
  }
  int total = 0;
  if (cnts[1] <= cnts[2]) {
    total += cnts[1];
    cnts[2] -= cnts[1];
    cnts[3] += cnts[1];
    while (cnts[2] >= 3) {
      cnts[2] -= 3;
      cnts[3] += 2;
      total += 2;
    }
    if (cnts[2] == 2) {
      total += 2;
      cout << total << endl;
      return 0;
    }
    if (cnts[4] >= cnts[2]) {
      total += cnts[2];
      cout << total << endl;
      return 0;
    } else {
      total += cnts[4];
      cnts[2] -= cnts[4];
      cnts[3] += cnts[4];
      if (cnts[2] == 1) {
        if (cnts[3] <= 1)
          cout << -1 << endl;
        else
          cout << total + 2 << endl;
        return 0;
      } else {
        total += 2;
        cout << total << endl;
        return 0;
      }
    }
  } else {
    cnts[3] += cnts[2];
    cnts[1] -= cnts[2];
    total += cnts[2];
    total += 2 * (cnts[1] / 3);
    cnts[3] += cnts[1] / 3;
    cnts[1] %= 3;
    if (cnts[1] == 1) {
      if (cnts[3] >= 1)
        cout << total + 1 << endl;
      else if (cnts[4] >= 2)
        cout << total + 2 << endl;
      else
        cout << -1 << endl;
      return 0;
    } else if (cnts[1] == 2) {
      if (cnts[3] >= 2 || cnts[4] >= 1)
        cout << total + 2 << endl;
      else
        cout << -1 << endl;
    } else
      cout << total << endl;
  }
  return 0;
}
