#include <bits/stdc++.h>
using namespace std;
int a, b, c, n, e[200010];
int tal = 0, bc = 0, ac = 0, ab = 0, a0 = 0, b0 = 0, c0 = 0;
int main() {
  scanf("%d%d%d%d", &n, &a, &b, &c);
  if (a > b) swap(a, b);
  if (a > c) swap(a, c);
  if (b > c) swap(b, c);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &e[i]);
    if (e[i] > a + b + c) {
      printf("-1\n");
      return 0;
    }
    if (e[i] > b + c)
      tal++;
    else if (e[i] > a + c)
      bc++;
    else if (a + b > c) {
      if (e[i] > a + b)
        ac++;
      else if (e[i] > c)
        ab++;
      else if (e[i] > b)
        c0++;
      else if (e[i] > a)
        b0++;
      else
        a0++;
    } else {
      if (e[i] > c)
        ac++;
      else if (e[i] > a + b)
        c0++;
      else if (e[i] > b)
        ab++;
      else if (e[i] > a)
        b0++;
      else
        a0++;
    }
  }
  bool deb = false;
  if (deb) printf("%d %d %d %d %d %d %d\n", a0, b0, c0, ab, ac, bc, tal);
  int ans = 0;
  ans += tal;
  ans += bc;
  a0 -= bc;
  ans += ac;
  if (b0 < ac) {
    a0 -= ac - b0;
    b0 = 0;
  } else
    b0 -= ac;
  if (a0 < 0) a0 = 0;
  if (a + b > c) {
    if (deb) printf("%d %d %d %d:%d\n", a0, b0, c0, ab, ans);
    ans += ab;
    if (c0 >= ab)
      c0 -= ab;
    else {
      ab -= c0;
      c0 = 0;
      if (b0 >= ab)
        b0 -= ab;
      else {
        ab -= b0;
        b0 = 0;
        a0 -= ab;
      }
    }
    if (deb) printf("%d %d %d: %d\n", a0, b0, c0, ans);
    if (a0 < 0) a0 = 0;
    int tmp = c0;
    if (b0 >= tmp)
      ans += c0, b0 -= tmp, a0 -= tmp;
    else {
      tmp -= b0;
      a0 -= b0;
      b0 = 0;
      if (a0 < 0) a0 = 0;
      if (a0 >= 2 * tmp)
        a0 -= 2 * tmp, ans += c0;
      else {
        tmp -= (a0 + 1) / 2;
        a0 = 0;
        ans += (c0 - tmp) + (tmp + 1) / 2;
      }
    }
    if (a0 < 0) a0 = 0;
    if (deb) printf("%d %d %d: %d\n", a0, b0, c0, ans);
    ans += (b0 + 1) / 2;
    if (a0 >= (b0 + 1) / 2)
      a0 -= (b0 + 1) / 2;
    else
      a0 = 0;
    if (b0 & 1) a0--;
    ans += (a0 + 2) / 3;
    printf("%d\n", ans);
  } else {
    int t1 = b0, tmp = b0;
    if (c0 > b0)
      c0 -= b0, a0 -= b0, ans += b0;
    else {
      tmp -= c0, a0 -= c0;
      c0 = 0;
      if (ab > tmp)
        ab -= tmp, a0 -= tmp, ans += b0;
      else {
        tmp -= ab, a0 -= ab;
        ab = 0;
        ans += b0 - tmp + (tmp + 1) / 2;
        a0 -= (tmp + 1) / 2;
        if (tmp & 1) a0--;
      }
    }
    if (a0 < 0) a0 = 0;
    int ntt = (a0 + 1) / 2, nt2 = (c0 + ab);
    if (nt2 > ntt) {
      ans += ntt;
      if (c0 > ntt)
        c0 -= ntt;
      else {
        ntt -= c0;
        c0 = 0;
        ab -= ntt;
      }
      if (ab < 0) ab = 0;
      ans += c0;
      ab -= c0;
      if (ab < 0) ab = 0;
      ans += (ab + 1) / 2;
    } else {
      ans += nt2;
      a0 -= nt2 * 2;
      ans += (a0 + 2) / 3;
    }
    printf("%d\n", ans);
  }
  return 0;
}
