#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void checkMin(T &a, T b) {
  if (b < a) a = b;
}
template <typename T>
inline void checkMax(T &a, T b) {
  if (a < b) a = b;
}
const int MAX_N = 200100;
int n, x[3], y[8], t[MAX_N];
int c[8];
int i;
int ms[8];
inline bool delall(int y, int o) {
  for (; o < 7; ++o) {
    int mask = ms[o];
    while (i && t[i - 1] > y) {
      if (c[mask] <= 0) break;
      --i;
      for (int m = 0; m < int(7); ++m) {
        if (mask & m) {
          --c[m];
        }
      }
    }
  }
  return !i || t[i - 1] <= y;
}
bool check() {
  i = n;
  for (int i = 0; i < int(7); ++i) ms[i] = i;
  if (y[3] > y[4]) swap(ms[3], ms[4]);
  if (!delall(y[5], 6)) return false;
  if (!delall(max(y[3], y[4]), 5)) return false;
  if (!delall(min(y[3], y[4]), 4)) return false;
  if (y[3] < y[4]) {
    swap(ms[3], ms[4]);
    if (!delall(y[2], 3)) return false;
    swap(ms[3], ms[4]);
  } else {
    if (!delall(y[2], 3)) return false;
  }
  if (!delall(y[1], 2)) return false;
  return i <= c[1] + c[2] + c[4];
}
int work() {
  sort(t, t + n);
  if (t[n - 1] > y[7]) return -1;
  int ans = 0;
  while (n > 0 && t[n - 1] > y[6]) {
    --n;
    ++ans;
  }
  int l = 0, r = 10 * n;
  while (l < r) {
    int m = (l + r) >> 1;
    fill(c, c + 8, m);
    if (check()) {
      r = m;
    } else {
      l = m + 1;
    }
  }
  return l + ans;
}
int main() {
  {
    static int c, s;
    while ((c = getchar()) != '-' && (c < '0' || c > '9'))
      ;
    c == '-' ? (s = 1, n = 0) : (s = 0, n = c - '0');
    while ((c = getchar()) >= '0' && c <= '9') {
      n = (n << 3) + (n << 1) + (c - '0');
    }
    if (s) n = -n;
  };
  for (int i = 0; i < int(3); ++i) {
    {
      static int c, s;
      while ((c = getchar()) != '-' && (c < '0' || c > '9'))
        ;
      c == '-' ? (s = 1, x[i] = 0) : (s = 0, x[i] = c - '0');
      while ((c = getchar()) >= '0' && c <= '9') {
        x[i] = (x[i] << 3) + (x[i] << 1) + (c - '0');
      }
      if (s) x[i] = -x[i];
    };
  }
  sort(x, x + 3);
  for (int j = 0; j < int(8); ++j) {
    for (int k = 0; k < int(3); ++k) {
      if ((j >> k) & 1) {
        y[j] += x[k];
      }
    }
  }
  for (int i = 0; i < int(n); ++i) {
    {
      static int c, s;
      while ((c = getchar()) != '-' && (c < '0' || c > '9'))
        ;
      c == '-' ? (s = 1, t[i] = 0) : (s = 0, t[i] = c - '0');
      while ((c = getchar()) >= '0' && c <= '9') {
        t[i] = (t[i] << 3) + (t[i] << 1) + (c - '0');
      }
      if (s) t[i] = -t[i];
    };
  }
  printf("%d\n", work());
  return 0;
}
