#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  vector<int> V;
  V.push_back(a);
  V.push_back(b);
  V.push_back(c);
  V.push_back(a + b);
  V.push_back(b + c);
  V.push_back(c + a);
  V.push_back(a + b + c);
  V.push_back(0);
  sort(V.begin(), V.end());
  int A[8];
  for (int i = 0; i < 8; i++) A[i] = 0;
  for (int i = 0; i < n; i++) {
    int tmp;
    scanf("%d", &tmp);
    int j = 0;
    while (j <= 6 && tmp > V[j + 1]) j++;
    ++A[j];
  }
  int ans = 0, tmp;
  if (A[7] > 0) {
    printf("-1\n");
    return 0;
  }
  ans += A[6];
  A[0] -= min(A[0], A[5]);
  ans += A[5];
  tmp = min(A[1], A[4]);
  A[1] -= tmp;
  A[4] -= tmp;
  ans += tmp;
  A[0] -= min(A[0], A[4]);
  ans += A[4];
  if (V[1] + V[2] == V[3]) {
    tmp = min(min(A[0], A[1]), A[3]);
    A[0] -= tmp;
    A[1] -= tmp;
    A[3] -= tmp;
    ans += tmp;
    if (A[1] == 0) {
      tmp = min(A[0] / 2, A[3]);
      A[0] -= 2 * tmp;
      A[3] -= tmp;
      ans += tmp;
    }
    tmp = min(A[2], A[3]);
    A[2] -= tmp;
    A[3] -= tmp;
    ans += tmp;
    tmp = min(A[1], A[3]);
    A[1] -= tmp;
    A[3] -= tmp;
    ans += tmp;
    A[0] -= min(A[0], A[3]);
    ans += A[3];
  } else {
    tmp = min(A[2], A[3]);
    A[2] -= tmp;
    A[3] -= tmp;
    ans += tmp;
    tmp = min(A[1], A[3]);
    A[1] -= tmp;
    A[3] -= tmp;
    ans += tmp;
    A[0] -= min(A[0], A[3]);
    ans += A[3];
  }
  tmp = min(A[0], min(A[1], A[2]));
  A[0] -= tmp;
  A[1] -= tmp;
  A[2] -= tmp;
  ans += tmp;
  if (A[2] == 0) {
    tmp = min(A[0], A[1] / 2);
    A[0] -= tmp;
    A[1] -= tmp * 2;
    ans += tmp;
    if (A[1] < 2)
      ans += (A[0] + A[1] + 2) / 3;
    else if (A[0] == 0)
      ans += (A[1] + 1) / 2;
  } else if (A[1] == 0) {
    tmp = min(A[0] / 2, A[2]);
    A[0] -= 2 * tmp;
    A[2] -= tmp;
    ans += tmp;
    if (A[2] == 0)
      ans += (A[0] + 2) / 3;
    else if (A[0] == 1)
      ans += 1 + A[2] / 2;
    else if (A[0] == 0)
      ans += (A[2] + 1) / 2;
  } else if (A[0] == 0) {
    tmp = min(A[1], A[2]);
    A[1] -= tmp;
    A[2] -= tmp;
    ans += tmp;
    ans += (A[1] + 1) / 2;
    ans += (A[2] + 1) / 2;
  }
  printf("%d\n", ans);
}
