#include <bits/stdc++.h>
using namespace std;
int a, b, c, n, m, x, y, z, k, w, ans, ans2;
int A[200005], B[200005], need[200005];
int main() {
  scanf("%d %d %d %d", &n, &a, &b, &c);
  z = max(a, max(b, c));
  x = min(a, min(b, c));
  y = a + b + c - x - z;
  a = x;
  b = y;
  c = z;
  x = y = z = 0;
  for (int i = (0); i < (n); i++) scanf("%d", &A[i]);
  sort(A, A + n);
  if (A[n - 1] > a + b + c) {
    printf("-1\n");
    return 0;
  }
  for (int i = (n - 1); i >= (0); i--)
    if (A[i] > b + c) {
      n = i;
      ans++;
    }
  for (int i = (n - 1); i >= (0); i--) {
    if (A[i] <= c) break;
    ans++;
    n = i;
    if (A[i] <= a + b)
      z++;
    else if (A[i] <= a + c)
      y++;
    else
      x++;
  }
  for (int i = (n - 1); i >= (0); i--) {
    if (A[i] <= b) {
      y += z;
      z = 0;
    }
    if (A[i] <= a) {
      x += y;
      y = 0;
    }
    if (z > 0)
      B[i] = 1, z--;
    else if (y > 0 && A[i] <= b)
      B[i] = 1, y--;
    else if (x > 0 && A[i] <= a)
      B[i] = 1, x--;
  }
  w = 0;
  for (int i = (0); i < (n); i++)
    if (B[i] == 0) A[w++] = A[i];
  n = w;
  x = y = z = 0;
  for (int i = (0); i < (n); i++) {
    if (A[i] <= a)
      x++;
    else if (A[i] <= b)
      y++;
    else if (A[i] <= a + b)
      z++;
    else {
      need[i] = -1;
      continue;
    }
    if (x > y)
      need[i] = z + y + (x - y + 1) / 2;
    else
      need[i] = z + y;
  }
  ans2 = n;
  for (int i = (0); i < (n); i++) {
    if (need[i] == -1) break;
    ans2 = min(ans2, max(need[i], n - i - 1));
  }
  ans += ans2;
  printf("%d\n", ans);
  return 0;
}
