#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1000010;
int n, s;
int d[10];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    d[x]++;
    s += x;
  }
  if (s == 1 || s == 2 || s == 5) {
    puts("-1");
    return 0;
  }
  int ans = 0;
  if (d[1] > d[2]) {
    ans += d[2];
    d[3] += d[2];
    d[1] -= d[2];
    d[2] = 0;
    ans += d[1] / 3 * 2;
    d[3] += d[1] / 3;
    d[1] %= 3;
    if (d[1] == 1) {
      if (d[3])
        ans++;
      else
        ans += 2;
    } else if (d[1] == 2) {
      ans += 2;
    }
  } else {
    ans += d[1];
    d[3] += d[1];
    d[2] -= d[1];
    d[1] = 0;
    ans += d[2] / 3 * 2;
    d[3] += d[2] / 3 * 2;
    d[2] %= 3;
    if (d[2] == 1) {
      if (d[4])
        ans++;
      else
        ans += 2;
    } else if (d[2] == 2) {
      ans += 2;
    }
  }
  cout << ans << endl;
  return 0;
}
