Problem: Given are N pairwise distinct non-negative integers A_1,A_2,\ldots,A_N. Find the number of ways to choose a set of between 1 and K numbers (inclusive) from the given numbers so that the following two conditions are satisfied:

* The bitwise AND of the chosen numbers is S.
* The bitwise OR of the chosen numbers is T.

Constraints

* 1 \leq N \leq 50
* 1 \leq K \leq N
* 0 \leq A_i < 2^{18}
* 0 \leq S < 2^{18}
* 0 \leq T < 2^{18}
* A_i \neq A_j (1 \leq i < j \leq N)

Input

Input is given from Standard Input in the following format:


N K S T
A_1 A_2 ... A_N


Output

Print the answer.

Examples

Input

3 3 0 3
1 2 3


Output

2


Input

5 3 1 7
3 4 9 1 5


Output

2


Input

5 4 0 15
3 4 9 1 5


Output

3

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod=1000000007;
const int MAXN=(1<<18), N=51, LOG=18;

ll n, m, k, u, v, x, y, S, T, ST, a, b, ans;
int A[N];
ll C[N][N];
int cnt[N], ted[MAXN];

void SOS(short* A){
	for (int j=0; j<LOG; j++)
		for (int i=0; i<MAXN; i++)
			if (i&(1<<j)) A[i]+=A[i^(1<<j)];
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	for (int i=0; i<N; i++){
		C[i][0]=C[i][i]=1;
		for (int j=1; j<i; j++) C[i][j]=C[i-1][j] + C[i-1][j-1];
	}
	cin>>n>>k>>S>>T;
	if ((S|T)!=T) kill(0)
	ST=S^T;
	for (int i=1; i<=n; i++){
		cin>>A[i];
		if ((A[i]|T)!=T || (A[i]&S)!=S){
			n--;
			i--;
			continue ;
		}
		A[i]&=ST;
	}
	for (int i=1; i<=k; i++) ans+=C[n][i];
	for (int mask=1; mask<MAXN; mask++) if ((mask|ST)==ST){
		memset(cnt, 0, sizeof(cnt));
		for (int i=1; i<=n; i++) ted[A[i]&mask]++;
		
		for (int sub=mask; sub; sub=(sub-1)&mask) cnt[ted[sub]]++;
		cnt[ted[0]]++;
		
//		debug(mask)
//		for (int bad=0; bad<=n; bad++) debug2(bad, cnt[bad])
		
		ll sum=0;
		for (int bad=0; bad<=n; bad++){
			for (int i=1; i<=k; i++) sum+=C[bad][i]*cnt[bad];
		}
//		debug2(mask, sum)
//		cerr<<'\n';
		
		if (__builtin_popcount(mask)&1) sum*=-1;
		ans+=sum;
		
		for (int i=1; i<=n; i++) ted[A[i]&mask]--;
	}
	cout<<ans<<'\n';
	
	return 0;
}