#include <bits/stdc++.h>
using namespace std;
int n, m, a, b, c, C[3], sd = 2333, sz;
int t[200005];
char ch, f;
inline void GET(int &n) {
  n = 0;
  f = 1;
  do {
    ch = getchar();
    if (ch == '-') f = -1;
  } while (ch > '9' || ch < '0');
  while (ch >= '0' && ch <= '9') {
    n = n * 10 + ch - '0';
    ch = getchar();
  }
  n *= f;
}
struct Treap {
  struct Node {
    int v, s[2], cnt, rnd;
  } t[200005];
  int root;
  const inline int Rand() { return sd = sd * sd % 1000007; }
  inline void Rot(int &k, bool f) {
    int p = t[k].s[f];
    t[k].s[f] = t[p].s[f ^ 1];
    t[p].s[f ^ 1] = k;
    k = p;
  }
  void insert(int &k, int v) {
    if (!k) {
      k = ++sz;
      t[k].v = v;
      t[k].rnd = Rand();
      t[k].cnt = 1;
      return;
    }
    if (t[k].v == v) {
      ++t[k].cnt;
      return;
    }
    bool f = v > t[k].v;
    insert(t[k].s[f], v);
    if (t[t[k].s[f]].rnd > t[k].rnd) Rot(k, f);
  }
  void erase(int &k, int v) {
    if (!k) return;
    if (t[k].v == v) {
      if (t[k].cnt > 1)
        --t[k].cnt;
      else if (t[k].s[0] * t[k].s[1] == 0)
        k = t[k].s[0] + t[k].s[1];
      else {
        bool f = t[t[k].s[1]].rnd > t[t[k].s[0]].rnd;
        Rot(k, f);
        erase(k, v);
      }
      return;
    }
    bool f = v > t[k].v;
    erase(t[k].s[f], v);
  }
  const int Prev(int k, int v, int p = 200003) {
    if (!k)
      return t[p].v;
    else if (t[k].v == v)
      return v;
    else if (t[k].v < v)
      return Prev(t[k].s[1], v, k);
    else
      return Prev(t[k].s[0], v, p);
  }
  const bool size() { return root; }
  const int Max() {
    int tmp = root;
    while (t[tmp].s[1]) tmp = t[tmp].s[1];
    return t[tmp].v;
  }
  void work(int val) {
    if (!root) return;
    int tmp = Prev(root, val);
    if (tmp == -1) return;
    n--;
    erase(root, tmp);
  }
} sbt;
int main() {
  scanf("%d", &n);
  sbt.root = 0;
  sbt.t[200003].v = -1;
  scanf("%d%d%d", &a, &b, &c);
  if (a > b) swap(a, b);
  if (a > c) swap(a, c);
  if (b > c) swap(b, c);
  for (int i = 1; i <= n; ++i) {
    GET(t[i]);
    sbt.insert(sbt.root, t[i]);
  }
  if (sbt.Max() > a + b + c) {
    puts("-1");
    return 0;
  }
  int cnt = 0;
  for (; sbt.size() && n;) {
    ++cnt;
    C[0] = C[1] = C[2] = 0;
    int mx = sbt.Max();
    if (mx <= a) {
      cnt--;
      cnt += (n + 2) / 3;
      break;
    } else if (mx <= b) {
      sbt.work(a);
      sbt.work(b);
      sbt.work(c);
    } else if (mx <= c) {
      bool flag = true;
      int tmp = sbt.Prev(sbt.root, a);
      if (tmp != -1) {
        int s1 = tmp;
        sbt.erase(sbt.root, tmp);
        tmp = sbt.Prev(sbt.root, b);
        if (tmp != -1) {
          sbt.erase(sbt.root, tmp);
          n -= 2;
          sbt.work(c);
        } else {
          sbt.insert(sbt.root, s1);
          flag = 0;
        }
      } else
        flag = 0;
      if (!flag) {
        int aa = a + b, bb = c;
        if (aa > bb) swap(aa, bb);
        sbt.work(aa);
        sbt.work(bb);
      }
    } else if (mx <= a + b) {
      int aa = c, bb = a + b;
      sbt.work(aa);
      sbt.work(bb);
    } else if (mx <= a + c) {
      int aa = b, bb = a + c;
      sbt.work(aa);
      sbt.work(bb);
    } else if (mx <= c + b) {
      int aa = a, bb = c + b;
      sbt.work(aa);
      sbt.work(bb);
    } else {
      sbt.work(a + b + c);
    }
  }
  printf("%d\n", cnt);
  return 0;
}
