#include #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") using namespace std; #define ll long long #define rep(i, m, n) for (ll i = m; i < n; i++) #define UE(N) N.erase(unique(N.begin(), N.end()), N.end()); #define Sort(n) sort(n.begin(), n.end()) #define mod 998244353 ll N, K; vector A; vector> B(1024, vector(1024)); void dfs(ll cnt, ll x, ll prev) { if(!cnt) B[prev][x]++; else { rep(i, 0, K) { if(A[i] == prev) continue; dfs(cnt - 1, x ^ A[i], A[i]); } } } void fwt(vector& f) { int n = f.size(); for(int i = 1; i < n; i <<= 1) { for(int j = 0; j < n; j++) { if((j & i) == 0) { ll x = f[j], y = f[j | i]; f[j] = x + y, f[j | i] = x - y; } } } } void ifwt(vector& f) { int n = f.size(); for(int i = 1; i < n; i <<= 1) { for(int j = 0; j < n; j++) { if((j & i) == 0) { ll x = f[j], y = f[j | i]; f[j] = (x + y) / 2, f[j | i] = (x - y) / 2; } } } } int main() { ios::sync_with_stdio(false); cin.tie(0); ll X, Y; cin >> N >> K >> X >> Y; A.resize(K); rep(i, 0, K) cin >> A[i]; Sort(A), UE(A); K = A.size(); dfs(N / 2, 0, -1); ll res = 0; vector C(1024), tmp(1024); rep(i, 0, 1024) rep(j, 0, 1024) tmp[i] += B[j][i]; rep(i, 0, 1024) rep(j, 0, 1024) C[i ^ j] = (C[i ^ j] + tmp[i] * tmp[j]) % mod; rep(i, 0, 1024) { fwt(B[i]); rep(j, 0, 1024) B[i][j] *= B[i][j]; ifwt(B[i]); } rep(i, 0, 1024) rep(j, 0, 1024) C[i] = (C[i] - B[j][i] + mod) % mod; rep(i, min(X, 1023LL), min(Y + 1, 1024LL)) res += C[i]; cout << res % mod << endl; }