#pragma GCC target("avx2") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #include using namespace std; const long long MOD = 998244353; void dfs(vector> &H, vector &A, int r, int prv, int x){ if (r == 0){ H[prv][x]++; } else { int K = A.size(); for (int j = 0; j < K; j++){ if (A[j] != prv){ dfs(H, A, r - 1, A[j], x ^ A[j]); } } } } int main(){ int N, K, X, Y; cin >> N >> K >> X >> Y; Y = min(Y, 1023); vector A(K); for (int i = 0; i < K; i++){ cin >> A[i]; } vector> H(1024, vector(1024, 0)); dfs(H, A, N / 2, -1, 0); vector sum(1024, 0); for (int i = 0; i < 1024; i++){ for (int j = 0; j < 1024; j++){ sum[j] += H[i][j]; sum[j] %= MOD; } } long long ans = 0; for (int i = 0; i < 1024; i++){ for (int j = 0; j < 1024; j++){ if (X <= (i ^ j) && (i ^ j) <= Y){ ans += sum[i] * sum[j]; ans %= MOD; } } } for (int i = 0; i < 1024; i++){ vector f; for (int j = 0; j < 1024; j++){ if (H[i][j] > 0){ f.push_back(j); } } int cnt = f.size(); for (int j = 0; j < cnt; j++){ for (int k = 0; k < cnt; k++){ if (X <= (f[j] ^ f[k]) && (f[j] ^ f[k]) <= Y){ ans += MOD - H[i][f[j]] * H[i][f[k]] % MOD; ans %= MOD; } } } } cout << ans << endl; }