#include <bits/stdc++.h>
using namespace std;
template <class T>
inline int sz(T a) {
  return a.size();
}
template <class T, class T2>
inline bool chkmax(T &x, const T2 &y) {
  return x < y ? x = y, 1 : 0;
}
template <class T, class T2>
inline bool chkmin(T &x, const T2 &y) {
  return x > y ? x = y, 1 : 0;
}
template <class T, class T2>
inline ostream &operator<<(ostream &os, const map<T, T2> &m) {
  auto id = m.begin();
  while (id != m.end()) os << *(id.first) << ' ' << *((id++).second);
  return os;
}
template <class T, class T2>
inline ostream &operator<<(ostream &os, const unordered_map<T, T2> &um) {
  auto id = um.begin();
  while (id != um.end()) os << *(id.first) << ' ' << *((id++).second);
  return os;
}
template <class T, class T2>
inline istream &operator>>(istream &is, pair<T, T2> &p) {
  is >> p.first >> p.second;
  return is;
}
template <class T, class T2>
inline ostream &operator<<(ostream &os, const pair<T, T2> &p) {
  os << p.first << ' ' << p.second;
  return os;
}
template <class T>
inline istream &operator>>(istream &is, vector<T> &v) {
  for (auto &curr : v) is >> curr;
  return is;
}
template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &v) {
  for (auto curr : v) os << curr << ' ';
  return os;
}
template <class T>
inline ostream &operator<<(ostream &os, const list<T> &l) {
  auto id = l.begin();
  while (id != l.end()) os << *(id++) << ' ';
  return os;
}
template <class T>
inline ostream &operator<<(ostream &os, const set<T> &second) {
  auto id = second.begin();
  while (id != second.end()) os << *(id++) << ' ';
  return os;
}
template <class T>
inline ostream &operator<<(ostream &os, const unordered_set<T> &us) {
  auto id = us.begin();
  while (id != us.end()) os << *(id++) << ' ';
  return os;
}
template <class T>
inline ostream &operator<<(ostream &os, const multiset<T> &ms) {
  auto id = ms.begin();
  while (id != ms.end()) os << *(id++) << ' ';
  return os;
}
template <class T>
inline ostream &operator<<(ostream &os, const unordered_multiset<T> &mus) {
  auto id = mus.begin();
  while (id != mus.end()) os << *(id++) << ' ';
  return os;
}
template <class T>
void inArray(T a[], const int &n) {
  for (int i = 0; i < n; i++) cin >> a[i];
}
template <class T>
void outArray(T a[], const int &n) {
  for (int i = 0; i < n; i++) cout << a[i] << ' ';
}
int n;
int cnt[5];
long long ans;
bool pos;
void input() {
  cin >> n;
  int a;
  for (int i = 0; i < n; i++) {
    cin >> a;
    cnt[a]++;
  }
}
void output() {
  if (!pos)
    cout << -1 << endl;
  else
    cout << ans << endl;
}
void solve() {
  int p = min(cnt[1], cnt[2]);
  cnt[1] -= p;
  cnt[2] -= p;
  cnt[3] += p;
  ans += p;
  pos = 1;
  if (cnt[1]) {
    p = cnt[1] / 3;
    cnt[3] += p;
    cnt[1] -= p * 3;
    ans += p * 2;
    if (cnt[1] == 1) {
      if (cnt[3] >= 1) {
        ans++;
        pos = 1;
      } else if (cnt[4] >= 2) {
        ans += 2;
        pos = 1;
      } else
        pos = 0;
    } else if (cnt[1] == 2) {
      if (cnt[4] >= 1 || cnt[3] >= 2) {
        ans += 2;
        pos = 1;
      } else
        pos = 0;
    }
  } else if (cnt[2]) {
    p = cnt[2] / 3;
    cnt[3] += p * 2;
    cnt[2] -= p * 3;
    ans += p * 2;
    if (cnt[2] == 1) {
      if (cnt[4] >= 1) {
        ans++;
        pos = 1;
      } else if (cnt[3] >= 2) {
        ans += 2;
        pos = 1;
      } else
        pos = 0;
    } else if (cnt[2] == 2) {
      ans += 2;
      pos = 1;
    }
  }
}
void start() {
  input();
  solve();
  output();
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  start();
  return 0;
}
