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>
using namespace std;

typedef unsigned long long ll;

int main(){
	int n,k,s,t;
	int a[52];
	scanf("%d%d%d%d",&n,&k,&s,&t);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	for(int j=0;j<18;j++){
		if(((s>>j)&1)==1&&((t>>j)&1)==0){
			puts("0");
			return 0;
		}
	}
	
	int n_=0;
	int a_[52];
	for(int i=1;i<=n;i++){
		bool ok=true;
		for(int j=0;j<18;j++){
			if(((s>>j)&1)==1&&((a[i]>>j)&1)==0)ok=false;
			if(((t>>j)&1)==0&&((a[i]>>j)&1)==1)ok=false;
		}
		if(ok){
			n_++;
			a_[n_]=a[i];
		}
	}
	n=n_;
	for(int i=1;i<=n_;i++){
		a[i]=a_[i];
	}
	
	if(n==0){
		puts("0");
		return 0;
	}
	vector<int> v;
	for(int j=0;j<18;j++){
		if(((s>>j)&1)==0&&((t>>j)&1)==1)v.push_back(j);
	}
	if(v.size()==0){
		if(n==1)puts("1");
		else puts("0");
		return 0;
	}
	for(int i=1;i<=n;i++){
		a_[i]=0;
		for(int j=0;j<v.size();j++){
			if((a[i]>>v[j])&1)a_[i]+=1<<j;
		}
		a[i]=a_[i];
	}
	int tt=v.size();
	
	ll ret=0;
	static int cnt[1<<18];
	static int dig[1<<18]={};
	for(int i=0;i<(1<<18);i++){
		dig[i]=0;
		for(int j=0;j<18;j++){
			if((i>>j)&1)dig[i]++;
		}
	}
	static ll C[52][52]={};
	C[0][0]=1;
	for(int i=1;i<=50;i++){
		C[i][0]=C[i][i]=1;
		for(int j=1;j<=i-1;j++){
			C[i][j]=C[i-1][j-1]+C[i-1][j];
		}
	}
	for(int i=0;i<=50;i++){
		for(int j=1;j<=50;j++){
			C[i][j]+=C[i][j-1];
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=0;j<(1<<tt);j++)cnt[j]=0;
		for(int j=i+1;j<=n;j++){
			cnt[((1<<tt)-1)^(a[i]^a[j])]++;
		}
		for(int k=0;k<tt;k++){
			for(int j=0;j<(1<<tt);j++){
				if((j>>k)&1){}
				else cnt[j]+=cnt[j+(1<<k)];
			}
		}
		for(int j=0;j<(1<<tt);j++){
			if(dig[j]&1)ret-=C[cnt[j]][k-1];
			else ret+=C[cnt[j]][k-1];
		}
	}
	cout<<ret<<endl;
}