#include #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define FORR(i,a,b) for (int i=(a);i>=(b);i--) #define pb push_back using namespace std; typedef long long ll; typedef pair pii; typedef vector vi; typedef set si; const int inf = 1e9; const int mod = 1e9+7; int b[4], n, e[30]; ll p[4]; main(){ cin.tie(0); ios::sync_with_stdio(false); FOR(i, 0, 3)cin >> b[i]; sort(b, b+3); b[3] = inf; cin >> n; FOR(i, 0, n)cin >> e[i]; sort(e, e + n); p[0] = 1; FOR(i, 0, n){ FORR(j, 3, 0){ if(e[i] >= b[j]){ p[j+1] += p[j]; }else{ p[j] *= 2; } } } cout << p[3] << endl; }