#include <bits/stdc++.h>
using namespace std;
int p[3];
int mas[200100];
void Solve() {
  int i, j, k, n, m;
  scanf("%d", &(n));
  scanf("%d%d%d", &(p[0]), &(p[1]), &(p[2]));
  sort(p, p + 3);
  for (i = 0; i < n; i++) scanf("%d", &(mas[i]));
  sort(mas, mas + n);
  if (mas[n - 1] > p[0] + p[1] + p[2]) {
    printf("-1");
    return;
  }
  int a = p[0];
  int b = p[1];
  int c = p[2];
  int ab = a + b;
  int ac = a + c;
  int bc = b + c;
  if (c > ab) {
  }
  int l = 0;
  int r = n;
  while (l + 1 < r) {
    m = (l + r) >> 1;
    int va = 0;
    int vb = 0;
    int vc = 0;
    int vab = 0;
    int vac = 0;
    int vbc = 0;
    int vabc = 0;
    for (i = n - 1; i >= 0; i--) {
      if (va + vac + vabc + vab < m && mas[i] <= a)
        va++;
      else if (vb + vbc + vab + vabc < m && mas[i] <= b)
        vb++;
      else if (vc + vac + vbc + vabc < m && mas[i] <= c)
        vc++;
      else if (va + vb + vab + vac + vbc + vabc < m && mas[i] <= ab)
        vab++;
      else if (va + vc + vab + vac + vbc + vabc < m && mas[i] <= ac)
        vac++;
      else if (vb + vc + vab + vac + vbc + vabc < m && mas[i] <= bc)
        vbc++;
      else if (va + vb + vc + vab + vac + vbc + vabc < m)
        vabc++;
      else
        break;
    }
    if (i >= 0)
      l = m;
    else
      r = m;
  }
  printf("%d", r);
}
int main() {
  Solve();
  return 0;
}
