#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1000000001;
const long long int LLINF = 1000000000000000001LL;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  int m[3];
  for (int i = (0); i <= (2); ++i) cin >> m[i];
  sort(m, m + 3);
  int a = m[0], b = m[1], c = m[2];
  vector<int> T(n);
  for (int i = (0); i <= ((int)(T).size() - 1); ++i) cin >> T[i];
  sort(T.begin(), T.end());
  if (T.back() > a + b + c) {
    cout << -1;
    return 0;
  }
  int allNeeded = 0;
  int bcNeeded = 0;
  int acNeeded = 0;
  while (!T.empty() && T.back() > b + c) {
    T.pop_back();
    allNeeded++;
  }
  while (!T.empty() && T.back() > a + c) {
    T.pop_back();
    bcNeeded++;
  }
  while (!T.empty() && T.back() > max(a + b, c)) {
    T.pop_back();
    acNeeded++;
  }
  int minAns = allNeeded + bcNeeded + acNeeded;
  int L = minAns - 1;
  int R = n;
  while (R - L > 1) {
    int mid = (L + R) / 2;
    int leftForC = mid - minAns;
    int it = (int)(T).size() - 1;
    int abNeeded = 0;
    int bNeeded = 0;
    bool good = true;
    while (it >= 0 && leftForC) {
      if (T[it] > c)
        abNeeded++;
      else
        leftForC--;
      it--;
    }
    if (it >= 0 && T[it] > a + b) {
      good = false;
    }
    while (it >= 0 && T[it] > b) {
      abNeeded++;
      it--;
    }
    while (it >= 0 && T[it] > a) {
      bNeeded++;
      it--;
    }
    int leftForA = mid - (allNeeded + acNeeded + abNeeded);
    int leftForB = mid - (allNeeded + bcNeeded + abNeeded + bNeeded);
    good = good && (leftForA >= 0);
    good = good && (leftForB >= 0);
    good = good && (leftForA + leftForB >= it + 1);
    good = good && (abNeeded + acNeeded + bcNeeded + allNeeded <= mid);
    if (good) {
      R = mid;
    } else {
      L = mid;
    }
  }
  cout << R;
  return 0;
}
