#include <bits/stdc++.h>
using namespace std;
int a[5];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    int sum = 0;
    int x;
    memset(a, 0, sizeof a);
    for (int i = 0; i < n; i++) {
      scanf("%d", &x);
      a[x]++;
    }
    int cnt = 0;
    int d = min(a[1], a[2]);
    cnt += d;
    a[1] -= d;
    a[2] -= d;
    a[3] += d;
    bool fg = 0;
    if (a[1]) {
      cnt += a[1] / 3 * 2;
      a[3] += a[1] / 3;
      a[1] %= 3;
      if (a[1] == 1) {
        if (a[3]) {
          cnt++;
          fg = 1;
        } else if (a[4] >= 2) {
          cnt += 2;
          fg = 1;
        } else
          fg = 0;
      }
      if (a[1] == 2) {
        if (a[3] >= 2 || a[4]) {
          cnt += 2;
          fg = 1;
        }
      }
      if (!a[1]) fg = 1;
      if (!fg)
        cout << -1 << endl;
      else
        cout << cnt << endl;
    } else if (a[2]) {
      cnt += (a[2] / 3) * 2;
      a[3] += a[2] / 3 * 2;
      a[2] %= 3;
      if (a[2] == 2) {
        cnt += 2;
        fg = 1;
      }
      if (a[2] == 1) {
        if (a[4]) {
          cnt++;
          fg = 1;
        } else if (a[3] >= 2) {
          cnt += 2;
          fg = 1;
        }
      }
      if (!a[2]) fg = 1;
      if (!fg)
        cout << -1 << endl;
      else
        cout << cnt << endl;
    } else
      cout << cnt << endl;
  }
}
