#include <bits/stdc++.h>
template <class T>
T min(T a, T b) {
  return a > b ? b : a;
}
template <class T>
T max(T a, T b) {
  return a < b ? b : a;
}
void solve() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  int n, t, s = 0, r = 0;
  std::cin >> n;
  int a[5] = {0, 0, 0, 0, 0};
  for (unsigned int i = 0; i < n; i++) {
    std::cin >> t;
    a[t]++;
    s += t;
  }
  if (s == 1 || s == 2 || s == 5) {
    std::cout << -1;
    return;
  }
  int max_pos = a[1] > a[2] ? 1 : 2;
  int min_cnt = a[3 - max_pos];
  r += min_cnt;
  a[3] += min_cnt;
  a[max_pos] -= min_cnt;
  r += a[max_pos] / 3 * 2;
  a[3] += a[max_pos] / 3 * 3;
  a[max_pos] %= 3;
  if (a[max_pos] == 1 && a[max_pos + 2]) {
    r += 1;
  } else if (a[max_pos]) {
    r += 2;
  }
  std::cout << r;
  return;
}
int main() {
  solve();
  return 0;
}
