#include #include #include #include #include #include using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<(n);i++) const int INF = 1e9; int main(void){ vector s(3); int n; rep(i, 3) cin >> s[i]; cin >> n; sort(s.begin(), s.end()); vector e(n); rep(i, n) cin >> e[i]; sort(e.begin(), e.end()); ll ans = 0; for (int i = 0; i < n; ++i){ for (int j = i + 1; j < n; ++j){ for (int k = j + 1; k < n; ++k){ if(s[0] <= e[i] && s[1] <= e[j] && s[2] <= e[k]){ // printf("k\n"); ans += pow(2, i); } } } } printf("%lld\n", ans); }