#include <bits/stdc++.h>
using namespace std;
int n, cnt[8], num[8], t;
int solve(int x) {
  int a = cnt[0], b = cnt[1], ab = cnt[2], c = cnt[3];
  int na = x, nb = x, nc = c + ab - x;
  if (a == 0 && b == 0) return max(nb, nc);
  if (abs(nc - nb) >= b) {
    if (nc >= nb)
      nb += b;
    else
      nc += b;
  } else {
    int tot = nb + nc + b;
    nc = tot / 2;
    nb = tot - nc;
  }
  int tmp = 3 * max(na, max(nb, nc)) - na - nb - nc;
  if (tmp >= a)
    return max(na, max(nb, nc));
  else {
    tmp = na + nb + nc + a;
    return tmp / 3 + (tmp % 3 != 0);
  }
}
int main() {
  scanf("%d%d%d%d", &n, &num[0], &num[1], &num[2]);
  num[3] = num[0] + num[1];
  num[4] = num[0] + num[2];
  num[5] = num[1] + num[2];
  num[6] = num[0] + num[1] + num[2];
  sort(num, num + 7);
  bool hasAns = true;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &t);
    if (t > num[6])
      hasAns = false;
    else {
      for (int j = 0; j < 7; ++j)
        if (t <= num[j]) {
          cnt[j]++;
          break;
        }
    }
  }
  if (!hasAns) {
    puts("-1");
    return 0;
  }
  int na = 0, nb = 0, nc = 0;
  na = cnt[6], nb = cnt[6], nc = cnt[6];
  na += min(cnt[0], cnt[5]), nb += cnt[5], nc += cnt[5];
  cnt[0] -= min(cnt[0], cnt[5]);
  na += cnt[4], nb += min(cnt[0] + cnt[1], cnt[4]), nc += cnt[4];
  int tmp = min(cnt[0] + cnt[1], cnt[4]);
  if (cnt[1] >= tmp)
    cnt[1] -= tmp;
  else {
    tmp -= cnt[1];
    cnt[1] = 0;
    cnt[0] -= min(cnt[0], tmp);
  }
  int ans = n;
  int l, r, ml, mr;
  if (num[0] + num[1] == num[2])
    l = 0, r = cnt[2];
  else
    l = cnt[3], r = cnt[2] + cnt[3];
  for (int i = l; i <= r; ++i) ans = min(ans, nc + solve(i));
  printf("%d\n", ans);
  return 0;
}
