#include <bits/stdc++.h>
int crs[5];
int n, allm;
int main() {
  scanf("%d", &n);
  int vl;
  for (int i = 0; i < n; i++) {
    scanf("%d", &vl);
    allm += vl;
    crs[vl]++;
  }
  int sol = allm * 2;
  for (int i = 0; i * 4 <= allm; i++) {
    if ((allm - i * 4) % 3 == 0) {
      int j = (allm - i * 4) / 3;
      if (i + j <= n) {
        int cst = allm;
        int crs2[5];
        for (int k = 0; k < 5; k++) crs2[k] = crs[k];
        int i2 = i;
        int k = 4;
        while (k > 0) {
          if (i2 == 0) {
            if (j == 0) break;
            if (k == 4) {
              if (j < crs2[4]) {
                cst -= j * 3;
                crs2[4] -= j;
                j = 0;
              } else {
                cst -= crs2[4] * 3;
                j -= crs2[4];
                crs2[4] = 0;
              }
            } else {
              if (j < crs2[k]) {
                cst -= j * k;
                crs2[k] -= j;
                j = 0;
              } else {
                cst -= crs2[k] * k;
                j -= crs2[k];
                crs2[k] = 0;
              }
            }
          } else {
            if (i2 < crs2[k]) {
              cst -= i2 * k;
              crs2[k] -= i2;
              i2 = 0;
            } else {
              cst -= crs2[k] * k;
              i2 -= crs2[k];
              crs2[k] = 0;
            }
          }
          if (crs2[k] == 0) k--;
        }
        if (sol > cst) sol = cst;
      }
    }
  }
  if (sol < allm * 2) {
    printf("%d\n", sol);
  } else {
    printf("-1\n");
  }
  return 0;
}
