#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool upmin(T &x, T y) {
  return y < x ? x = y, 1 : 0;
}
template <typename T>
inline bool upmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
const long double eps = 1e-11;
const long double pi = acos(-1);
const long long oo = 1 << 30;
const long long loo = 1ll << 62;
const long long mods = 998244353;
const long long MAXN = 200005;
const long long INF = 0x3f3f3f3f;
inline long long read() {
  long long f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
long long cnt1 = 0, cnt2 = 0, x, y, z, n, num = 0;
multiset<long long> Set;
void Erase(long long t) {
  multiset<long long>::iterator it = Set.upper_bound(t);
  if (it != Set.begin()) {
    it--;
    if (*it <= x + y) cnt2--;
    if (*it <= z) cnt1--;
    Set.erase(it);
  }
}
signed main() {
  n = read(), x = read(), y = read(), z = read(), num = 0;
  if (x > y) swap(x, y);
  if (x > z) swap(x, z);
  if (y > z) swap(y, z);
  for (long long i = 1, x; i <= n; i++) x = read(), Set.insert(x);
  while (Set.size()) {
    long long t = *Set.rbegin();
    if (x + y + z < t) {
      puts("-1");
      return 0;
    } else if (t > y + z)
      num++, Set.erase(Set.find(t));
    else if (t > x + z) {
      num++, Set.erase(Set.find(t));
      multiset<long long>::iterator it = Set.upper_bound(x);
      if (it != Set.begin()) it--, Set.erase(it);
    } else if (t > max(x + y, z)) {
      num++, Set.erase(Set.find(t));
      multiset<long long>::iterator it = Set.upper_bound(y);
      if (it != Set.begin()) it--, Set.erase(it);
    } else
      break;
  }
  long long ans = INF;
  for (multiset<long long>::iterator it = Set.begin(); it != Set.end(); it++)
    cnt1 += (*it <= z), cnt2 += (*it <= x + y);
  upmin(ans, max((cnt2 + 1) / 2,
                 max((cnt1 + 1) / 2, max(cnt1 - cnt2, cnt2 - cnt1))));
  for (long long i = 1; i <= n; i++) {
    Erase(z), Erase(y), Erase(x);
    upmin(ans, i + max((cnt2 + 1) / 2,
                       max((cnt1 + 1) / 2, max(cnt1 - cnt2, cnt2 - cnt1))));
  }
  printf("%d\n", ans + num);
  return 0;
}
