#include <bits/stdc++.h>
using namespace std;
int t[200005];
int solve(int a, int b, int c, int ab) {
  int r = 0;
  int tmp = 0;
  r += ab;
  tmp = min(ab, c);
  c -= tmp;
  ab -= tmp;
  tmp = min(ab, b);
  b -= tmp;
  ab -= tmp;
  tmp = min(ab, a);
  a -= tmp;
  ab -= tmp;
  ab = 0;
  tmp = min(min(a, b), c);
  r += tmp;
  a -= tmp;
  b -= tmp;
  c -= tmp;
  if (c) {
    if (a) {
      r += c;
      a -= 2 * c;
      a = max(a, 0);
      c = 0;
      return r + (a + 2) / 3;
    } else {
      r += c;
      b = max(0, b - c);
      return r + (b + 1) / 2;
    }
  } else {
    tmp = b / 2;
    r += tmp;
    b -= tmp * 2;
    a = max(0, a - tmp);
    if (b) ++r, a = max(0, a - 2);
    return r + (a + 2) / 3;
  }
}
int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  for (int i = (int)(0); i < (int)(n); ++i) scanf("%d", t + i);
  sort(t, t + n);
  if (t[n - 1] > a + b + c) {
    cout << -1 << endl;
    return 0;
  }
  if (a > b) swap(a, b);
  if (b > c) swap(b, c);
  if (a > b) swap(a, b);
  int cnt[] = {0, 0, 0};
  int cnt2[] = {0, 0, 0};
  int cnt3 = 0;
  int weird = 0;
  for (int i = (int)(0); i < (int)(n); ++i) {
    int first = t[i];
    if (first <= a) {
      ++cnt[0];
      continue;
    }
    if (first > b + c) {
      ++cnt3;
      continue;
    }
    if (first > c) {
      if (first <= a + b)
        ++cnt2[0];
      else if (first <= a + c)
        ++cnt2[1];
      else
        ++cnt2[2];
      continue;
    }
    if (first <= b) {
      ++cnt[1];
      continue;
    }
    if (first > a + b) {
      ++cnt[2];
      continue;
    }
    ++weird;
  }
  int R = 0;
  R += cnt3;
  cnt3 = 0;
  R += cnt2[2];
  cnt[0] -= min(cnt[0], cnt2[2]);
  cnt2[2] = 0;
  R += cnt2[1];
  if (cnt2[1] <= cnt[1])
    cnt[1] -= cnt2[1];
  else
    cnt[0] -= min(cnt[0], cnt2[1] - cnt[1]), cnt[1] = 0;
  cnt2[1] = 0;
  int cr = 1000000000;
  for (int i = (int)(0); i < (int)(weird + 1); ++i)
    cr = min(cr, solve(cnt[0], cnt[1], cnt[2] + i, cnt2[0] + weird - i));
  cout << R + cr << endl;
  return 0;
}
