#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000111;
const int MOD = 1000000007;
const int S_N = 100010;
template <typename A, typename B>
ostream& operator<<(ostream& out, pair<A, B>& p) {
  cout << "(" << p.first << "," << p.second << ") ";
}
template <typename A, typename B>
void printP(const pair<A, B>& p, const char* str = NULL) {
  if (str != NULL) cout << str << ":";
  cout << "(" << p.first << "," << p.second << ") ";
}
template <typename T>
void printV(const vector<T>& v, const char* str = NULL) {
  if (str != NULL) cout << str << ": ";
  for (int i = 0; i < (v.size()); ++i) cout << v[i] << " ";
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> C(5, 0);
  int sum = 0;
  for (int i = 0; i < (n); ++i) {
    int x;
    cin >> x;
    if (x > 0) C[x]++;
    sum += x;
  }
  if (sum == 5 || sum == 1 || sum == 2) {
    cout << "-1" << endl;
    return 0;
  }
  int swaps = 0;
  while (C[1] && C[2]) {
    C[1]--, C[2]--, C[3]++, swaps++;
  }
  while (C[1] >= 3) {
    C[1] -= 3;
    C[3] += 1;
    swaps += 2;
  }
  while (C[2] >= 3) {
    C[2] -= 3;
    C[3] += 2;
    swaps += 2;
  }
  if (C[1] == 1) {
    if (C[3])
      swaps++;
    else
      swaps += 2;
  } else if (C[1] == 2) {
    swaps += 2;
  } else if (C[2] == 1) {
    if (C[4])
      swaps++;
    else
      swaps += 2;
  } else if (C[2] == 2) {
    swaps += 2;
  }
  cout << swaps << endl;
  return 0;
  return 0;
}
