#include <bits/stdc++.h>
using namespace std;
int n, a, b, c, D, e;
int cs[200020];
int all[200020], A[4], AA[4];
int i, x, y, z, tmp, tim, m;
int main() {
  cin >> n;
  cin >> a >> b >> c;
  if (a > c) swap(a, c);
  if (a > b) swap(a, b);
  if (b > c) swap(b, c);
  A[1] = a;
  A[2] = b;
  A[3] = c;
  for (i = 1; i <= n; i++) {
    scanf("%d", &D);
    if (D > a + b + c) {
      cout << -1 << endl;
      return 0;
    }
    if (D > b + c) {
      tim++;
      continue;
    }
    m++;
    all[m] = D;
  }
  AA[1] = m;
  AA[2] = m;
  AA[3] = m;
  sort(all + 1, all + m + 1);
  for (i = m; i >= 1; i--) {
    if (all[i] && c < all[i]) {
      if (a + b >= all[i])
        e = 3;
      else if (a + c >= all[i])
        e = 2;
      else
        e = 1;
      AA[e] = min(AA[e], i - 1);
      while (AA[e] >= 0 && all[AA[e]] == 0 || all[AA[e]] > A[e]) AA[e]--;
      tim++;
      all[AA[e]] = 0;
      all[i] = 0;
    }
  }
  n = 0;
  for (i = 1; i <= m; i++)
    if (all[i]) {
      n++;
      cs[n] = all[i];
    }
  if (n == 0) {
    cout << tim << endl;
    return 0;
  }
  int l = 1;
  int r = n - 1;
  int ress = n;
  while (l <= r) {
    m = (l + r) / 2;
    int k = n - m;
    if (a + b < cs[k]) {
      l = m + 1;
      continue;
    }
    int ja = 0;
    for (ja = 1; ja <= k; ja++)
      if (cs[ja] > a) break;
    ja--;
    int jb = 0;
    for (jb = 1; jb <= k; jb++)
      if (cs[jb] > b) break;
    jb--;
    while (jb - ja < ja) ja--;
    if (max(ja, jb - ja) + k - jb <= m) {
      ress = m;
      r = m - 1;
    } else
      l = m + 1;
  }
  cout << ress + tim << endl;
}
