#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10, mod = 1e9 + 7;
const long long inf = 1e18;
multiset<int> st;
int ans = 0;
void f(int big, int small) {
  int cnt = 0;
  while (int((st).size()) && (*st.rbegin()) > big) {
    cnt++;
    st.erase(st.find(*st.rbegin()));
  }
  ans += cnt;
  auto it = st.upper_bound(small);
  while (int((st).size()) && cnt && it != st.begin()) {
    cnt--;
    st.erase(prev(it));
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie();
  int n;
  cin >> n;
  int a, b, c;
  cin >> a >> b >> c;
  if (a > b) swap(a, b);
  if (a > c) swap(a, c);
  if (b > c) swap(b, c);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    st.insert(x);
  }
  if ((*st.rbegin()) > a + b + c) return cout << -1 << endl, 0;
  f(b + c, -1);
  f(a + c, a);
  if (a + b >= c) {
    f(a + b, b);
    f(c, c);
  } else {
    f(c, b);
  }
  int extra = n, A = 0, B = 0, AB = 0, now = 0;
  if (int((st).size()) == 0) extra = 0;
  for (auto x : st) {
    if (x <= a)
      A++;
    else if (x <= b)
      B++;
    else if (x <= a + b)
      AB++;
    else
      break;
    now++;
    extra = min(extra,
                max(int((st).size()) - now, AB + B + max(0, (A - B + 1) / 2)));
  }
  ans += extra;
  return cout << ans << endl, 0;
}
