#include <bits/stdc++.h>
using namespace std;
const int maxn = 200010;
const int INF = 1e9 + 10;
int n;
long long t[maxn];
long long a[10];
multiset<long long> s;
bool judge1(long long x) { return x <= a[3]; }
bool judge2(long long x) { return x <= a[2] + a[3]; }
bool judge3(long long x) { return x <= a[1] + a[2] + a[3]; }
int main() {
  while (cin >> n) {
    for (int i = 1; i <= 3; i++) scanf("%I64d", &a[i]);
    for (int i = 1; i <= n; i++) scanf("%I64d", &t[i]);
    sort(a + 1, a + 3 + 1);
    s.clear();
    for (int i = 1; i <= n; i++) s.insert(t[i]);
    long long ans = 0;
    bool flag = 1;
    for (int i = 1; i <= 2 * n; i++) {
      if (s.empty()) {
        ans = i - 1;
        break;
      }
      multiset<long long>::iterator it = s.end();
      --it;
      if (judge1(*it)) {
        int tag = 1, tx = 1;
        for (int j = 1; j <= 3; j++) {
          if (a[j] >= *it) {
            tx = j;
            s.erase(it);
            break;
          }
        }
        vector<long long> v;
        for (int j = 1; j <= 3; j++) {
          if (j != tx) v.push_back(a[j]);
        }
        int cnt = 0;
        for (int i = 0; i < v.size(); i++) {
          multiset<long long>::iterator it2 = s.upper_bound(v[i]);
          if (it2 != s.begin()) {
            --it2;
            s.erase(it2);
          } else
            cnt++;
        }
        if (cnt == 2) {
          long long sum = v[0] + v[1];
          multiset<long long>::iterator it2 = s.upper_bound(sum);
          if (it2 != s.begin()) {
            --it2;
            s.erase(it2);
          }
        }
      } else if (judge2(*it)) {
        vector<long long> v, v2;
        v.push_back(a[1] + a[2]);
        v2.push_back(a[3]);
        v.push_back(a[1] + a[3]);
        v2.push_back(a[2]);
        v.push_back(a[2] + a[3]);
        v2.push_back(a[1]);
        for (int j = 0; j < v.size(); j++) {
          if (v[j] >= *it) {
            s.erase(it);
            multiset<long long>::iterator it2 = s.upper_bound(v2[j]);
            if (it2 != s.begin()) {
              --it2;
              s.erase(it2);
            }
            break;
          }
        }
      } else if (judge3(*it)) {
        long long sum = a[1] + a[2] + a[3];
        if (sum >= *it)
          s.erase(it);
        else
          flag = 0;
      } else {
        flag = 0;
        break;
      }
      if (s.empty()) {
        ans = i;
        break;
      }
    }
    printf("%I64d\n", flag && s.empty() ? ans : -1);
  }
  return 0;
}
