func_code_string: #include <bits/stdc++.h>   using namespace std;   int sgn(double x) { return (x > 1e-8) - (x < -1e-8); }   int count_bit(int x) { return x == 0 ? 0 : count_bit(x >> 1) + (x & 1); }   template <class T>   inline void to_min(T &a, const T b) {     if (b < a) a = b;   }   template <class T>   inline void to_max(T &a, const T b) {     if (b > a) a = b;   }   const int maxn = 200000 + 10;   int n, a[3], w[maxn];   bool used[maxn];   int rearray(int n) {     int newn = 0;     for (int i = 0; i < (n); ++i) {       if (!used[i]) {         w[newn++] = w[i];       }     }     return newn;   }   int solve() {     int r = a[2] + a[1] + a[0];     if (r < w[n - 1]) {       return -1;     }     int ret = 0;     int l = a[2] + a[1];     while (n >= 0 && w[n - 1] > l) {       ++ret;       --n;     }     r = l;     l = a[2] + a[0];     memset(used, 0, sizeof(used));     int max_idx = upper_bound(w, w + n, a[0]) - w - 1;     while (n >= 0 && w[n - 1] > l) {       ++ret;       --n;       if (max_idx >= 0) {         used[max_idx--] = true;       }     }     n = rearray(n);     r = l;     l = max(a[2], a[1] + a[0]);     memset(used, 0, sizeof(used));     max_idx = upper_bound(w, w + n, a[1]) - w - 1;     while (n >= 0 && w[n - 1] > l) {       ++ret;       --n;       if (max_idx >= 0) {         used[max_idx--] = true;       }     }     n = rearray(n);     if (a[1] + a[0] > a[2]) {       r = a[1] + a[0];       l = a[2];       memset(used, 0, sizeof(used));       max_idx = upper_bound(w, w + n, a[2]) - w - 1;       while (n >= 0 && w[n - 1] > l) {         ++ret;         --n;         if (max_idx >= 0) {           used[max_idx--] = true;         }       }       n = rearray(n);     }     memset(used, 0, sizeof(used));     int idx_3 = n - 1;     int idx_2 = upper_bound(w, w + n, a[1]) - w;     int idx_1 = upper_bound(w, w + n, a[1]) - w - 1;     int idx_0 = 0;     while (true) {       while (idx_3 >= 0 && used[idx_3]) --idx_3;       if (idx_3 < 0) break;       used[idx_3--] = true;       ++ret;       if (idx_1 >= idx_0) {         while (idx_1 >= idx_0 && used[idx_1]) --idx_1;         if (idx_1 >= idx_0) {           used[idx_1--] = true;         }         while (idx_0 <= idx_1 && w[idx_0] <= a[0] && used[idx_0]) ++idx_0;         if (idx_0 <= idx_1 && w[idx_0] <= a[0]) {           used[idx_0++] = true;         }       } else {         if (!used[idx_2] && w[idx_2] <= a[0] + a[1]) {           used[idx_2++] = true;         }       }     }     return ret;   }   int main() {     ios::sync_with_stdio(false);     cout << fixed << setprecision(8);     cin >> n;     for (int i = 0; i < (3); ++i) {       cin >> a[i];     }     sort(a, a + 3);     for (int i = 0; i < (n); ++i) {       cin >> w[i];     }     sort(w, w + n);     cout << solve() << endl;     return 0;   }   