#include <bits/stdc++.h>
using namespace std;
int n;
int n1, n2, n3, n4, n5, n6, n7;
int a, b, c;
void doA(int i) {
  if (n1 >= i)
    n1 -= i;
  else
    n1 = 0;
}
void doB(int i) {
  if (n2 >= i)
    n2 -= i;
  else {
    doA(i - n2);
    n2 = 0;
  }
}
void doC(int i) {
  if (n3 >= i)
    n3 -= i;
  else {
    doB(i - n3);
    n3 = 0;
  }
}
void work() {
  int ans = 0;
  ans = n7;
  ans += n6;
  doA(n6);
  ans += n5;
  doB(n5);
  if (c < a + b) {
    ans += n4;
    doC(n4);
    int ANS = 0x3fffffff;
    for (int i = 0; i <= n3; i++) {
      int N1 = n1, N2 = n2, N3 = n3;
      int j = n3 - i;
      int now = max(i, j);
      if (i > j) {
        doB(i - j);
        doA(i - j);
      } else
        doB(j - i);
      now += max((n2 + 1) / 2, (n1 + n2 + 2) / 3);
      ANS = min(ANS, now);
      n1 = N1;
      n2 = N2;
      n3 = N3;
    }
    cout << ans + ANS << endl;
  } else {
    int ANS = 0x3fffffff;
    for (int i = n4; i <= n3 + n4; i++) {
      int N1 = n1, N2 = n2, N3 = n3;
      int j = n3 + n4 - i;
      int now = max(i, j);
      if (i > j) {
        doB(i - j);
        doA(i - j);
      } else
        doB(j - i);
      now += max((n2 + 1) / 2, (n1 + n2 + 2) / 3);
      ANS = min(ANS, now);
      n1 = N1;
      n2 = N2;
      n3 = N3;
    }
    cout << ans + ANS << endl;
  }
}
int main() {
  cin >> n;
  cin >> a >> b >> c;
  if (c < b) swap(b, c);
  if (b < a) swap(a, b);
  if (c < b) swap(b, c);
  int x1 = min(a + b, c), x2 = max(a + b, c);
  for (int i = 1; i <= n; i++) {
    int t;
    scanf("%d", &t);
    if (t > a + b + c) {
      cout << -1 << endl;
      return 0;
    }
    if (t <= a)
      n1++;
    else if (t <= b)
      n2++;
    else if (t <= x1)
      n3++;
    else if (t <= x2)
      n4++;
    else if (t <= a + c)
      n5++;
    else if (t <= b + c)
      n6++;
    else
      n7++;
  }
  work();
  return 0;
}
