#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
int c[5];
int n, m;
int solve() {
  int w;
  if (c[1] == c[2])
    return c[1];
  else if (c[1] > c[2]) {
    w = c[2];
    c[1] -= c[2], c[3] += c[2], c[2] = 0;
    w += c[1] / 3 * 2;
    c[3] += c[1] / 3, c[1] %= 3;
    switch (c[1]) {
      case 1:
        if (c[3] >= 1)
          w++;
        else if (c[4] >= 2)
          w += 2;
        else
          return -1;
        break;
      case 2:
        if (c[3] >= 2)
          w += 2;
        else {
          c[2] = 1, c[1] = 0;
          w++;
          if (c[4])
            w++;
          else
            return -1;
        }
        break;
    }
  } else {
    w = c[1];
    c[2] -= c[1], c[3] += c[1], c[1] = 0;
    w += c[2] / 3 * 2;
    c[3] += c[2] / 3 * 2, c[2] %= 3;
    switch (c[2]) {
      case 1:
        if (c[4] >= 1)
          w++;
        else if (c[3] >= 2)
          w += 2;
        else
          return -1;
        break;
      case 2:
        w += 2;
        break;
    }
  }
  return w;
}
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 0; i <= 4; ++i) c[i] = 0;
    for (int i = 0; i < n; ++i) {
      int x;
      scanf("%d", &x);
      c[x]++;
    }
    cout << solve() << endl;
  }
}
