func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e6 + 5;   int ans, cnt, tmp;   int main() {     int n;     cin >> n;     int a[] = {0, 0, 0, 0, 0};     for (int i = 0; i < n; i++) {       int x;       cin >> x;       a[x]++;       cnt += x;     }     if (cnt == 5 || cnt < 3) return cout << -1, 0;     ans += min(a[1], a[2]);     a[1] -= ans, a[2] -= ans, a[3] += ans;     if (a[1] != 0) {       ans += a[1] / 3 * 2;       a[3] += a[1] / 3;       a[1] = a[1] % 3;       if (a[1] == 1) {         if (a[3] != 0)           ans += 1;         else           ans += 2;       } else if (a[1] == 2) {         ans += 2;       }       return cout << ans, 0;     } else if (a[2] != 0) {       ans += a[2] / 3 * 2;       a[3] += a[2] / 3 * 2;       a[2] = a[2] % 3;       if (a[2] == 1) {         if (a[4] != 0)           ans++;         else           ans += 2;       } else if (a[2] == 2) {         ans += 2;       }       return cout << ans, 0;     }     cout << ans;     return 0;   }   