#include <bits/stdc++.h>
using namespace std;
int n, a[12], s, b[int(1e6) + 123], ans;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    a[b[i]]++;
  }
  int C = min(a[1], a[2]);
  ans += C;
  a[1] -= C;
  a[2] -= C;
  a[3] += C;
  C = a[1] / 3;
  a[1] -= C * 3;
  ans += C * 2;
  a[3] += C;
  if (a[1] == 1) {
    if (a[3] > 0) {
      ans++;
      a[3]--;
      a[1]--;
      a[4]++;
    } else if (a[4] >= 2) {
      a[4] -= 2;
      a[3] += 3;
      a[1]--;
      ans += 2;
    } else {
      cout << -1;
      return 0;
    }
  }
  if (a[1] == 2) {
    if (a[4] > 0) {
      a[4]--;
      a[3]++;
      a[1] = 0;
      ans += 2;
    } else if (a[3] >= 2) {
      a[3] -= 2;
      a[1] = 0;
      a[4] += 2;
      ans += 2;
    } else {
      cout << -1;
      return 0;
    }
  }
  C = a[2] / 3;
  ans += C * 2;
  a[2] -= C * 3;
  a[3] += C * 2;
  if (a[2] == 1) {
    if (a[4] > 0) {
      a[4]--;
      a[3]++;
      a[2] = 0;
      ans++;
    } else if (a[3] >= 2) {
      a[3] -= 2;
      a[4] += 2;
      a[2] = 0;
      ans += 2;
    } else {
      cout << -1;
      return 0;
    }
  }
  if (a[2] == 2) {
    a[2] = 0;
    a[4]++;
    ans += 2;
  }
  cout << ans;
}
