#include #include using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000000000000000 int N,K,X,Y; vector B; vector> cnt(1024,vector(1024,0)); void dfs(int n,int x,int last){ if(n==0){ cnt[last][x]++; return; } rep(i,B.size()){ if(i==last)continue; dfs(n-1,x^B[i],i); } } template 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) { T x = f[j], y = f[j | i]; f[j] = x + y, f[j | i] = x - y; } } } } template 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) { T x = f[j], y = f[j | i]; f[j] = (x + y) / 2, f[j | i] = (x - y) / 2; } } } } long long get(vector v){ fwt(v); rep(i,v.size())v[i] *= v[i]; ifwt(v); long long ret= 0LL; for(int i=X;i<=min(Y,1024);i++)ret += v[i]; return ret; } int main(){ cin>>N>>K>>X>>Y; set A; rep(i,K){ int a; cin>>a; if(A.count(a))continue; A.insert(a); B.push_back(a); } dfs(N/2,0,-1); vector Cnt(1024,0); rep(i,1024){ rep(j,1024)Cnt[i] += cnt[j][i]; } long long ans = get(Cnt); //cout<