#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int a[10];
  while (cin >> n) {
    memset(a, 0, sizeof(a));
    int sum = 0;
    for (int i = 1; i <= n; i++) {
      int x;
      cin >> x;
      a[x]++;
      sum += x;
    }
    int x, y, flag = 0;
    for (x = 0; 3 * x <= sum; x++) {
      if ((sum - 3 * x) % 4 == 0) {
        y = (sum - 3 * x) / 4;
        if (x + y <= n) {
          flag = 1;
          break;
        }
      }
    }
    if (!flag)
      puts("-1");
    else {
      int ans = 0;
      if (a[1] >= a[2]) {
        ans += a[2];
        a[1] -= a[2];
        a[3] += a[2];
        ans += a[1] / 3 * 2;
        a[3] += a[1] / 3;
        a[1] %= 3;
        if (a[1] == 1) {
          if (a[3])
            ans++;
          else
            ans += 2;
        } else if (a[1] == 2)
          ans += 2;
      } else {
        ans += a[1];
        a[2] -= a[1];
        ans += a[2] / 3 * 2;
        a[2] %= 3;
        if (a[2] == 2)
          ans += 2;
        else if (a[2] == 1) {
          if (a[4])
            ans += 1;
          else
            ans += 2;
        }
      }
      cout << ans << endl;
    }
  }
}
