#include <bits/stdc++.h>
using namespace std;
long long int powmod(long long int a, int b, int n) {
  long long int rm = 1;
  while (b) {
    if (b % 2) {
      rm = (rm * a) % n;
    }
    a = (a * a) % n;
    b /= 2;
  }
  return rm;
}
int main() {
  int n, a[10] = {0}, q;
  cin >> n;
  for (int i = int(1); i <= (int)n; i++) {
    scanf("%d", &q);
    ;
    a[q]++;
  }
  int move = 0;
  if (a[1] >= a[2]) {
    move = a[2];
    a[3] += a[2];
    a[1] -= a[2];
    a[2] = 0;
  } else {
    move = a[1];
    a[2] -= a[1];
    a[3] += a[1];
    a[1] = 0;
  }
  if (a[1] == 0 && a[2] == 0) {
    cout << move << endl;
    return 0;
  }
  if (a[1]) {
    int tmp = a[1] / 3;
    move += 2 * tmp;
    a[3] += tmp;
    a[1] %= 3;
    if (a[1]) {
      if (a[3] >= a[1]) {
        move += a[1];
        cout << move << endl;
        return 0;
      } else {
        if (a[1] == 2) {
          if (a[4] >= 1) {
            move += 2;
            cout << move << endl;
            return 0;
          } else {
            cout << -1 << endl;
            return 0;
          }
        } else if (a[1] == 1) {
          if (a[4] > 1) {
            move += 2;
            cout << move << endl;
            return 0;
          } else {
            cout << -1 << endl;
            return 0;
          }
        }
      }
    } else {
      cout << move << endl;
      return 0;
    }
  } else if (a[2]) {
    int tmp = a[2] / 3;
    move += 2 * tmp;
    a[3] += 2 * tmp;
    a[2] %= 3;
    if (!a[2]) {
      cout << move << endl;
      return 0;
    } else if (a[2]) {
      if (a[2] == 1) {
        if (a[4]) {
          move++;
          cout << move << endl;
          return 0;
        } else if (a[3] > 1) {
          move += 2;
          cout << move << endl;
          return 0;
        } else {
          cout << -1 << endl;
          return 0;
        }
      } else if (a[2] == 2) {
        move += 2;
        cout << move << endl;
        return 0;
      }
    }
  }
  return 0;
}
