#include #include #include #include #include #include #include using namespace std; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); int x[3], e[30]; for(int i = 0; i < 3; i++) { cin >> x[i]; } sort(x, x + 3); int N; cin >> N; for(int i = 0; i < N; i++) { cin >> e[i]; } 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++) { int y[3] = { e[i], e[j], e[k] }; sort(y, y + 3); if(x[0] <= y[0] && x[1] <= y[1] && x[2] <= y[2]) { ans += 1 << i; } } } } cout << ans << endl; }