#include <bits/stdc++.h>
using namespace std;
int n, x, j, k, l, a, b, c;
multiset<int, greater<int> > ms;
multiset<int, greater<int> >::iterator it, e;
bool era(int x) {
  it = ms.find(x);
  if (it != ms.end()) {
    ms.erase(it);
    return true;
  }
  ms.insert(x);
  it = ms.find(x);
  e = it++;
  if (it != ms.end()) ms.erase(it);
  ms.erase(e);
  return it != ms.end();
}
int main() {
  scanf("%d", &n);
  scanf("%d %d %d", &j, &k, &l);
  a = min({j, k, l});
  c = max({j, k, l});
  b = j + k + l - a - c;
  for (int i = 1; i <= n; i++) scanf("%d", &x), ms.insert(x);
  if (*ms.begin() > a + b + c) return puts("-1"), 0;
  int ans = 0;
  while (ms.size()) {
    int now = *ms.begin();
    if (now <= a) {
      ans += ((int)ms.size() + 2) / 3;
      break;
    }
    ans++;
    if (now <= b)
      era(a), era(b), era(c);
    else if (now <= c) {
      era(c);
      if (era(a))
        era(b);
      else
        era(a + b);
    } else if (now <= a + b)
      era(a + b), era(c);
    else if (now <= a + c)
      era(a + c), era(b);
    else if (now <= b + c)
      era(a), era(b + c);
    else
      era(a + b + c);
  }
  printf("%d\n", ans);
  return 0;
}
