#include <bits/stdc++.h>
#define endl '\n'
#define int unsigned
using namespace std;
const int MAXN = (1 << 20);
void Read(int &x);
int n;
int c[3];
int a[MAXN];
set<pair<int, int> > s;
void read()
{
Read(n);
for(int i = 0; i < 3; i++)
Read(c[i]);
int ssda = 1;
for(int i = 0; i < n; i++)
{
int val;
Read(val);
s.insert({val, ssda++});
}
}
void stop()
{
printf("-1\n");
fflush(stdin);
exit(0);
}
void solve()
{
sort(c, c + 3);
set<pair<int, int> >::iterator it, x, y, f;
int ans = 0, last_sz = -1;
while(s.size() != 0)
{
if(last_size == s.size())
{
ans = -1;
break;
}
last_sz = s.size();
it = --s.end();
int val = it->first;
if(c[0] + c[1] + c[2] < val)
{
ans = -1;
break;
}
if(c[1] + c[2] < val)
{
ans++;
s.erase(it);
continue;
}
if(c[0] >= val)
{
s.erase(it);
ans++;
y = s.lower_bound({c[2], 0}), f = s.lower_bound({c[1] + c[2], 0});
if((f == s.end() || f->first > c[1] + c[2]) && f != s.begin()) --f;
if((y == s.end() || y->first > c[2]) && y != s.begin()) --y;
if(y == s.end() || y->first > c[2])
{
if(f == s.end()) continue;
if(f->first <= c[1] + c[2]) s.erase(f);
else if(f != s.begin()) s.erase(--f);
continue;
}
if(y->first <= c[2]) s.erase(y);
else if(y != s.begin()) s.erase(--y);
x = s.lower_bound({c[1], 0});
if((x == s.end() || x->first > c[1]) && x != s.begin()) --x;
if(x->first <= c[1]) s.erase(x);
else if(x != s.begin()) s.erase(--x);
continue;
}
if(c[1] >= val)
{
s.erase(it);
ans++;
y = s.lower_bound({c[2], 0}), f = s.lower_bound({c[2] + c[0], 0});
if((f == s.end() || f->first > c[2] + c[0]) && f != s.begin()) --f;
if((y == s.end() || y->first > c[2]) && y != s.begin()) --y;
if(y == s.end() || y->first > c[2])
{
if(f == s.end()) continue;
if(f->first <= c[2] + c[0]) s.erase(f);
else if(f != s.begin()) s.erase(--f);
continue;
}
if(y->first <= c[2]) s.erase(y);
else if(y != s.begin()) s.erase(--y);
x = s.lower_bound({c[0], 0});
if((x == s.end() || x->first > c[0]) && x != s.begin()) --x;
if(x->first <= c[0]) s.erase(x);
else if(x != s.begin()) s.erase(--x);
continue;
}
if(c[2] >= val)
{
s.erase(it);
ans++;
y = s.lower_bound({c[1], 0}), f = s.lower_bound({c[1] + c[0], 0});
if((f == s.end() || f->first > c[1] + c[0]) && f != s.begin()) --f;
if((y == s.end() || y->first > c[1]) && y != s.begin()) --y;
if(y == s.end() || y->first > c[1])
{
if(f == s.end()) continue;
if(f->first <= c[1] + c[0]) s.erase(f);
else if(f != s.begin()) s.erase(--f);
continue;
}
if(y->first <= c[1]) s.erase(y);
else if(y != s.begin()) s.erase(--y);
x = s.lower_bound({c[0], 0});
if((x == s.end() || x->first > c[0]) && x != s.begin()) --x;
if(x->first <= c[0]) s.erase(x);
else if(x != s.begin()) s.erase(--x);
continue;
}
if(c[0] + c[1] >= val)
{
s.erase(it);
ans++;
f = s.lower_bound({c[2], 0});
if(f == s.end() && f == s.begin()) continue;
if(f == s.end()) --f;
if(f->first <= c[2]) s.erase(f);
else if(f != s.begin()) s.erase(--f);
continue;
}
if(c[0] + c[2] >= val)
{
s.erase(it);
ans++;
f = s.lower_bound({c[1], 0});
if(f == s.end() && f == s.begin()) continue;
if(f == s.end()) --f;
if(f->first <= c[1]) s.erase(f);
else if(f != s.begin()) s.erase(--f);
continue;
}
if(c[1] + c[2] >= val)
{
s.erase(it);
ans++;
f = s.lower_bound({c[0], 0});
if(f == s.end() && f == s.begin()) continue;
if(f == s.end()) --f;
if(f->first <= c[0]) s.erase(f);
else if(f != s.begin()) s.erase(--f);
continue;
}
}
printf("%d\n", ans);
fflush(stdin);
}
#undef int
int main()
{
//freopen("in.in", "r", stdin);
read();
solve();
return 0;
}
#define int unsigned
#define maxl 100000
char sir[maxl];
int pos = 0;
void Next()
{
if (++pos == maxl) fread (sir, 1, maxl, stdin), pos = 0;
}
void Read(int &x)
{
for (;sir[pos] < '0' || sir[pos] > '9'; Next ());
for (x = 0; sir[pos] >= '0' && sir[pos] <= '9'; Next ()) x = x * 10 + sir[pos] - '0';
}