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>
#define rep(i,n) for ((i)=1;(i)<=(n);(i)++)
#define foreach(c,it) for (__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
using namespace std;
int n,m,s,t,i,j;
long long ans,c[55][55];
vector<int> v,bt;
long long calc(int t)
{
	int i;
	long long ans=0;
	for(i=1;i<=min(t,m);i++){
		ans+=c[t][i];
	} 
	return ans;
}
void dfs(int x,int xs,const vector<int> &v)
{
	if(x>=bt.size()){
		ans+=xs*calc(v.size());
		return;
	}
	dfs(x+1,xs,v);
	vector<int> t0,t1;
	foreach(v,i){
		if(((*i)>>x)&1){
			t1.push_back(*i);
		}
		else{
			t0.push_back(*i);
		}
	}
	if(!t0.empty()) dfs(x+1,-xs,t0);
	if(!t1.empty()) dfs(x+1,-xs,t1);
}
int main(){
	cin>>n>>m>>s>>t;
	c[0][0]=1;
	rep(i,n){
		c[i][0]=1;
		rep(j,i){
			c[i][j]=c[i-1][j]+c[i-1][j-1];
		}
	}
	if((s&t)!=s){
		puts("0");
		return 0;
	}
	if((s|t)!=t){
		puts("0");
		return 0;
	}
	for(i=0;i<18;i++){
		if(((t>>i)&1)&&!((s>>i)&1)){
			bt.push_back(i);
		}
	}
	rep(i,n){
		int x;
		cin>>x;
		if((s&x)!=s) continue;
		if((t|x)!=t) continue;
		int y=0;
		for(j=0;j<bt.size();j++){
			y|=(((x>>bt[j])&1)<<j);
		}
		v.push_back(y);
//		cerr<<y<<endl;
	}
	dfs(0,1,v);
	cout<<ans<<endl;
	return 0;
}