#include <bits/stdc++.h>
using namespace std;
int n;
int a, b, c;
vector<vector<int> > group;
multiset<int> has;
int main() {
  scanf("%d", &n);
  scanf("%d%d%d", &a, &b, &c);
  for (int r = 0; r < 2; r++) {
    if (a > b) swap(a, b);
    if (b > c) swap(b, c);
  }
  group.push_back({c + b + a});
  group.push_back({c + b, a});
  group.push_back({c + a, b});
  if (b + a > c) group.push_back({b + a, c});
  group.push_back({c, b, a});
  for (int i = 0; i < n; i++) {
    int t;
    scanf("%d", &t);
    has.insert(t);
  }
  if (*has.rbegin() > a + b + c) return printf("-1\n"), 0;
  int ans = 0;
  for (int i = 0; i < group.size() - 1; i++) {
    if (!has.size()) break;
    int next = group[i + 1][0];
    while (has.size() && *has.rbegin() > next) {
      ans += 1;
      has.erase(--has.end());
      for (int j = 1; j < group[i].size(); j++) {
        auto it = has.upper_bound(group[i][j]);
        if (it == has.begin()) continue;
        has.erase(--it);
      }
    }
  }
  if (1) {
    int zero = has.size();
    int one = 0;
    for (int i : has)
      if (i <= b + a) one += 1;
    int two = 0;
    for (int i : has)
      if (i <= b) two += 1;
    int three = 0;
    for (int i : has)
      if (i <= a) three += 1;
    zero -= one;
    one -= two;
    two -= three;
    int extra = 1e9;
    for (int i = 0; i <= one; i++) {
      int abtake = i;
      int nzero = zero;
      int none = one;
      int ntwo = two;
      int nthree = three;
      int cur = 0;
      cur += nzero;
      int has = nzero;
      nzero = 0;
      int go = min(abtake, has);
      none -= min(none, go);
      has -= go;
      abtake -= go;
      go = min(ntwo, has);
      nthree -= min(nthree, go);
      ntwo -= min(ntwo, go);
      has -= go;
      go = min((nthree + 1) / 2, has);
      nthree -= min(nthree, go * 2);
      cur += min(abtake, none / 2);
      has = min(abtake, none / 2);
      none -= has * 2;
      cur += none;
      has = none;
      none = 0;
      go = min(ntwo, has);
      ntwo -= min(ntwo, go);
      nthree -= min(nthree, go);
      has -= go;
      go = min((nthree + 1) / 2, has);
      nthree -= min(nthree, go * 2);
      cur += ntwo / 2;
      has = ntwo / 2;
      ntwo %= 2;
      nthree -= min(nthree, has);
      cur += ntwo;
      has = ntwo;
      ntwo = 0;
      go = min((nthree + 1) / 2, has);
      nthree -= min(nthree, go * 2);
      cur += (nthree + 2) / 3;
      nthree = 0;
      extra = min(extra, cur);
    }
    ans += extra;
    has.clear();
  }
  printf("%d\n", ans);
  return 0;
}
