#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int mx = INT_MAX;
const long double pi = 4 * atan((long double)1);
int n;
int arr[5];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  int ditme = 0;
  int sum = ditme;
  while (n--) {
    int temp;
    cin >> temp;
    arr[temp]++;
    int lon = temp;
    sum += lon;
  }
  if (sum < 3 or sum == 5) return cout << -1, 0;
  int ans = min(arr[1], arr[2]);
  arr[1] -= ans;
  arr[2] -= ans;
  if (!arr[1] and !arr[2]) return cout << ans, 0;
  if (arr[1] > 0) {
    if (arr[1] % 3 == 0) return cout << ans + arr[1] / 3 * 2, 0;
    ans += arr[1] / 3 * 2;
    arr[3] += arr[1] / 3;
    arr[1] %= 3;
    if (arr[3] >= arr[1]) return cout << ans + arr[1], 0;
    return cout << ans + 2, 0;
  }
  if (arr[2] % 3 == 0) return cout << ans + arr[2] / 3 * 2, 0;
  ans += arr[2] / 3 * 2;
  arr[3] += arr[2] / 3;
  arr[2] %= 3;
  if (arr[2] == 2) return cout << ans + 2, 0;
  if (arr[4]) return cout << ans + 1, 0;
  return cout << ans + 2, 0;
  return cout << ans, 0;
}
