#include //#include #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") //namespace mp = boost::multiprecision; //using Bll = mp::cpp_int; using namespace std; #define ll long long #define rep(i, m, n) for (ll i = m; i < n; i++) #define rrep(i, m, n) for (ll i = m - 1; i >= n; i--) #define pb(n) push_back(n) #define UE(N) N.erase(unique(N.begin(), N.end()), N.end()); #define Sort(n) sort(n.begin(), n.end()) #define Rev(n) reverse(n.begin(), n.end()) #define HpOut(S) cout << setprecision(50) << S << endl #define Vec(K, L, N, S) vector K(N, S) #define DV(K, L, N, M, S) vector> K(N, vector(M, S)) #define TV(K, L, N, M, R, S) \ vector>> K(N, vector>(M, vector(R, S))) #define pint pair #define tint tuple #define paf(L, R) pair #define mod 998244353 #define MAX 10010 #define ALL(a) a.begin(), a.end() #define chmax(a, b) a = (((a) < (b)) ? (b) : (a)) #define chmin(a, b) a = (((a) > (b)) ? (b) : (a)) ll N, K; vector A; vector> ans(1024, vector(1024)); void dfs(ll cnt, ll x, ll prev) { if(!cnt) ans[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(); ll L = N / 2; dfs(L, 0, -1); ll res = 0; vector cus(1024), tmp(1024); rep(i, 0, 1024) rep(j, 0, 1024) tmp[i] += ans[j][i]; rep(i, 0, 1024) rep(j, 0, 1024) cus[i ^ j] = (cus[i ^ j] + tmp[i] * tmp[j]) % mod; rep(i, 0, 1024) { fwt(ans[i]); rep(j, 0, 1024) ans[i][j] *= ans[i][j]; ifwt(ans[i]); } rep(i, 0, 1024) rep(j, 0, 1024) cus[i] = (cus[i] - ans[j][i] + mod) % mod; chmin(X, 1023); chmin(Y, 1023); rep(i, X, Y + 1) res += cus[i]; cout << res % mod << endl; }