// Musketeers
// AC, O(n log(n))
// by Errichto
#include<bits/stdc++.h>
using namespace std;
const int nax = 1e6 + 5;
const int inf = 1e9 + 5;
int m[3];
multiset<int> enemies;
void greedy(int atLeast, int extra, int & ans) {
while(!enemies.empty()) {
auto it = enemies.end();
--it;
if(*it < atLeast) break;
enemies.erase(it);
++ans;
it = enemies.lower_bound(extra);
if(it != enemies.begin()) {
--it;
enemies.erase(it);
}
}
}
int main() {
int n;
scanf("%d", &n);
for(int i = 0; i < 3; ++i) scanf("%d", &m[i]);
sort(m, m + 3);
for(int i = 0; i < n; ++i) {
int x;
scanf("%d", &x);
--x;
enemies.insert(x);
}
int all = m[0] + min(inf, m[1] + m[2]);
auto it = enemies.end();
--it;
if(*it >= all) {
puts("-1");
return 0;
}
int ans = 0;
greedy(m[1] + m[2], 0, ans);
greedy(m[0] + m[2], m[0], ans);
greedy(max(m[0]+m[1], m[2]), m[1], ans);
int one = 0, two = 0;
for(int x : enemies) {
if(x < m[0] + m[1]) ++one;
if(x < m[2]) ++two;
}
int best = inf;
for(int rep = 0; rep < n + 5; ++rep) {
if(max(one, two) == (int) enemies.size()) {
if(2 * min(one, two) >= (int) enemies.size()) best = min(best, rep + ((int) enemies.size() + 1) / 2);
else best = min(best, rep + (int) enemies.size() - min(one, two));
}
for(int i = 0; i < 3; ++i) {
auto it = enemies.lower_bound(m[i]);
if(it != enemies.begin()) {
--it;
if(*it < m[0] + m[1]) --one;
if(*it < m[2]) --two;
enemies.erase(it);
}
}
}
printf("%d\n", ans + best);
return 0;
}
Ly8gTXVza2V0ZWVycwovLyBBQywgTyhuIGxvZyhuKSkKLy8gYnkgRXJyaWNodG8KI2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNvbnN0IGludCBuYXggPSAxZTYgKyA1Owpjb25zdCBpbnQgaW5mID0gMWU5ICsgNTsKaW50IG1bM107Cm11bHRpc2V0PGludD4gZW5lbWllczsKCnZvaWQgZ3Jl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