#include <bits/stdc++.h>
using namespace std;
int between(vector<int> &V, int A, int B) {
  int c = 0;
  vector<int> NV;
  for (int i = 0; i < V.size(); ++i) {
    if (V[i] > A && V[i] <= B) {
      c++;
    } else {
      NV.push_back(V[i]);
    }
  }
  V = NV;
  return c;
}
int remSmallerAnd(vector<int> &V, int A, int cnt) {
  vector<int> NV;
  int c = 0;
  for (int i = 0; i < V.size(); ++i) {
    if (c < cnt && V[i] <= A) {
      c++;
    } else {
      NV.push_back(V[i]);
    }
  }
  V = NV;
  return c;
}
int test(vector<int> V, int A, int B, int C, int turns) {
  int ia = 0, ib = 0, ic = 0;
  vector<int> NV;
  for (int i = 0; i < V.size(); ++i) {
    if (V[i] <= C && ic < turns) {
      ic++;
    } else {
      NV.push_back(V[i]);
    }
  }
  V = NV;
  for (int i = 0; i < V.size(); ++i) {
    if (V[i] > A + B) {
      return false;
    } else if (V[i] > B) {
      ia++;
      ib++;
    } else if (V[i] > A) {
      ib++;
    } else if (ia < turns) {
      ia++;
    } else {
      ib++;
    }
  }
  return ia <= turns && ib <= turns && ic <= turns;
}
int main() {
  int N;
  cin >> N;
  int A, B, C;
  cin >> A >> B >> C;
  if (C < A) swap(A, C);
  if (C < B) swap(B, C);
  if (B < A) swap(A, B);
  vector<int> V(N);
  for (int i = 0; i < N; ++i) {
    cin >> V[i];
  }
  sort(V.rbegin(), V.rend());
  if (V[0] > A + B + C) {
    cout << -1 << endl;
    return 0;
  }
  int ans = 0;
  int three = between(V, B + C, A + B + C);
  ans += three;
  int bc = between(V, A + C, B + C);
  ans += bc;
  bc -= remSmallerAnd(V, A, bc);
  int ac = between(V, max(A + B, C), A + C);
  ans += ac;
  ac -= remSmallerAnd(V, B, ac);
  {
    int lo = 0, hi = V.size();
    while (lo < hi) {
      int mid = (lo + hi) / 2;
      if (test(V, A, B, C, mid)) {
        hi = mid;
      } else {
        lo = mid + 1;
      }
    }
    ans += lo;
  }
  cout << ans << endl;
}
