#include <bits/stdc++.h>
using namespace std;
int main() {
  int z;
  cin >> z;
  int ans = 0;
  int arr[5] = {0}, total = 0;
  for (int i = 0; i < z; i++) {
    int x;
    scanf("%d", &x);
    arr[x]++;
    total += x;
  }
  if (total == 1 || total == 2 || total == 5) {
    printf("%d ", -1);
    return 0;
  }
  while (arr[1] && arr[2]) {
    arr[3]++, arr[1]--, arr[2]--;
    ans++;
  }
  if (arr[1]) {
    ans += arr[1] - arr[1] / 3;
    if (arr[1] == 1 && !arr[3]) {
      ans++;
    }
  }
  if (arr[2]) {
    ans += arr[2] - arr[2] / 3;
    if (arr[2] % 3 == 1 && !arr[4]) {
      ans++;
    }
  }
  printf("%d ", ans);
  return 0;
}
