#include <bits/stdc++.h>
using namespace std;
const int N = 3;
const int M = 222222;
int a[N];
int b[M];
int n;
multiset<int, greater<int> > mts;
bool check(int mid) {
  bool c[M] = {0};
  int Acnt = mid, Bcnt = mid, Ccnt = mid;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (b[i] <= a[2] && Ccnt > 0) {
      c[i] = true;
      Ccnt--;
    }
  }
  for (int i = 0; i < n; i++) {
    if (c[i]) continue;
    if (b[i] <= a[0]) {
      if (Acnt > 0)
        Acnt--;
      else if (Bcnt > 0)
        Bcnt--;
      else if (Ccnt > 0)
        Ccnt--;
      else
        return false;
    } else if (b[i] <= a[1]) {
      if (Bcnt)
        Bcnt--;
      else if (Ccnt)
        Ccnt--;
      else
        return false;
    } else if (b[i] <= a[0] + a[1]) {
      if (Acnt && Bcnt) {
        Acnt--;
        Bcnt--;
      } else if (Acnt && Ccnt) {
        Acnt--;
        Ccnt--;
      } else if (Bcnt && Ccnt) {
        Bcnt--;
        Ccnt--;
      } else
        return false;
    } else {
      assert(Ccnt == 0);
      return false;
    }
  }
  return true;
}
void solve() {
  sort(a, a + N);
  vector<pair<int, int> > vec;
  int sum = a[0] + a[1] + a[2];
  for (int i = 0; i < N; i++) {
    vec.push_back(make_pair(a[i], 1 << i));
    vec.push_back(make_pair(sum - a[i], 7 ^ (1 << i)));
  }
  vec.push_back(make_pair(sum, 7));
  sort(vec.begin(), vec.end());
  int ans = 0;
  if (sum < *mts.begin()) {
    cout << -1 << endl;
    return;
  }
  while (!mts.empty()) {
    int head = *mts.begin();
    int index = -1;
    for (int i = 0; i < vec.size(); i++) {
      if (vec[i].first >= head) {
        index = i;
        break;
      }
    }
    if (index < 4) break;
    mts.erase(mts.begin());
    int mask = vec[index].second;
    for (int i = 0; i < N; i++) {
      if (~mask >> i & 1) {
        multiset<int, greater<int> >::iterator it = mts.lower_bound(a[i]);
        if (it != mts.end()) mts.erase(it);
      }
    }
    ans++;
  }
  n = 0;
  while (!mts.empty()) {
    b[n++] = *mts.begin();
    mts.erase(mts.begin());
  }
  sort(b, b + n, greater<int>());
  int l = 0, r = 2 * n;
  int res = -1;
  if (n > 0) {
    while (l <= r) {
      int mid = l + r >> 1;
      if (check(mid))
        r = mid - 1, res = mid;
      else
        l = mid + 1;
    }
  }
  assert(res != -1);
  cout << ans + res << endl;
}
int main() {
  cin >> n;
  for (int i = 0; i < 3; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    mts.insert(x);
  }
  solve();
  return 0;
}
