#include <bits/stdc++.h>
using namespace std;
const int MOD7 = 1e9 + 7;
const int MOD9 = 1e9 + 9;
const double EPS = 1e-9;
long long int gcd(long long int a, long long int b) {
  return b == 0 ? a : gcd(b, a % b);
}
int toint(const string &s) {
  stringstream second;
  second << s;
  int x;
  second >> x;
  return x;
}
long long int mpow(long long int a, long long int n, int mod) {
  long long int ret = 1;
  long long int b = a;
  while (n) {
    if (n & 1) ret = (ret * b) % mod;
    b = (b * b) % mod;
    n >>= 1;
  }
  return (long long int)ret;
}
struct cmp {
  bool operator()(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
    if (a.first.first < b.first.first)
      return true;
    else if (a.first.first == b.first.first)
      return a.first.second < b.first.second;
    return false;
  }
};
set<int> myset;
map<int, int> hashm;
int main() {
  int tc;
  tc = 1;
  int i, n, m, a, b, c, last, pastime, elem;
  while (tc--) {
    scanf("%d", &n);
    scanf("%d%d%d", &a, &b, &c);
    if (a >= b && a >= c) {
      if (b < c) swap(b, c);
    } else if (b >= a && b >= c) {
      swap(a, b);
      if (b < c) swap(b, c);
    } else {
      swap(a, c);
      if (b < c) swap(b, c);
    }
    vector<int> v;
    for (i = 0; i < n; i++) {
      scanf("%d", &m);
      hashm[m]++;
      myset.insert(m);
      v.push_back(m);
    }
    sort(v.begin(), v.end());
    pastime = 0;
    m = n;
    while (m > 0) {
      last = *(myset.rbegin());
      if (c >= last) {
        pastime += (m / 3) + (m % 3 == 0 ? 0 : 1);
        break;
      } else if (b >= last) {
        hashm[last]--;
        if (hashm[last] == 0) myset.erase(last);
        m--;
        if (m) {
          last = *(myset.rbegin());
          hashm[last]--;
          if (hashm[last] == 0) myset.erase(last);
          m--;
        }
        if (m && myset.upper_bound(c) != myset.begin()) {
          elem = *(--myset.upper_bound(c));
          hashm[elem]--;
          if (hashm[elem] == 0) myset.erase(elem);
          m--;
        }
      } else if (a >= last) {
        hashm[last]--;
        if (hashm[last] == 0) myset.erase(last);
        m--;
        if (m && myset.upper_bound(b) != myset.begin()) {
          elem = *(--myset.upper_bound(b));
          hashm[elem]--;
          if (hashm[elem] == 0) myset.erase(elem);
          m--;
          if (m && myset.upper_bound(c) != myset.begin()) {
            elem = *(--myset.upper_bound(c));
            hashm[elem]--;
            if (hashm[elem] == 0) myset.erase(elem);
            m--;
          }
        } else if (m && myset.upper_bound(b + c) != myset.begin()) {
          elem = *(--myset.upper_bound(b + c));
          hashm[elem]--;
          if (hashm[elem] == 0) myset.erase(elem);
          m--;
        }
      } else if (b + c >= last) {
        hashm[last]--;
        if (hashm[last] == 0) myset.erase(last);
        m--;
        if (m && myset.upper_bound(a) != myset.begin()) {
          elem = *(--myset.upper_bound(a));
          hashm[elem]--;
          if (hashm[elem] == 0) myset.erase(elem);
          m--;
        }
      } else if (a + c >= last) {
        hashm[last]--;
        if (hashm[last] == 0) myset.erase(last);
        m--;
        if (m && myset.upper_bound(b) != myset.begin()) {
          elem = *(--myset.upper_bound(b));
          hashm[elem]--;
          if (hashm[elem] == 0) myset.erase(elem);
          m--;
        }
      } else if (a + b >= last) {
        hashm[last]--;
        if (hashm[last] == 0) myset.erase(last);
        m--;
        if (m && myset.upper_bound(c) != myset.begin()) {
          elem = *(--myset.upper_bound(c));
          hashm[elem]--;
          if (hashm[elem] == 0) myset.erase(elem);
          m--;
        }
      } else if (a + c + b >= last) {
        hashm[last]--;
        if (hashm[last] == 0) myset.erase(last);
        m--;
      } else {
        pastime = -1;
        break;
      }
      pastime++;
    }
    printf("%d\n", pastime);
  }
  return 0;
}
