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 ll long long
#define N 52
using namespace std;
int n,k,s,t,a[N],x,p=18,vi[22];
ll b[22],ma,c[N][N],an[N],ans;
int tr(int x){
	int su=0;
	for (int i=0,j=0;i<18;i++){if (vi[i]){if (x&(1<<i))su+=(1<<j);j++;}}
	return su;
}
int main(){
	cin>>n>>k>>s>>t;
	c[0][0]=1;
	for (int i=1;i<=n;i++){
		c[i][0]=1;for (int j=1;j<=n;j++)c[i][j]=c[i-1][j]+c[i-1][j-1];
	}
	for (int i=1;i<=n;i++){
		for (int j=1;j<=min(i,k);j++)an[i]+=c[i][j];
	}
	for (int i=1;i<=n;i++){
		cin>>x;
		if (((x&s)!=s)||((x|t)!=t)){i--,n--;}
		else a[i]=x;
	}
	for (int i=0;i<18;i++)if((s&(1<<i))^(t&(1<<i)))vi[i]=1;else vi[i]=0,p--;
	for (int i=1;i<=n;i++)a[i]=tr(a[i]);s=tr(s);t=tr(t);
	for (int i=1;i<=n;i++)
		for (int j=0;j<p;j++)if (a[i]&(1<<j))b[j]+=((1ll)<<i);
	ll ma=((1ll)<<(n+1))-2;
	for (int i=1;i<=n;i++){
		for (int j=0;j<(1<<p);j++){
			ll no=ma;int su=0,s1=0;
			for (int k=0;k<p;k++)if (j&(1<<k)){su++;if (a[i]&(1<<k))no=no&b[k];else no=no&(ma^b[k]);}
			if (no&(((1ll)<<i)-1))continue;
			for (int i=1;i<=n;i++)if (no&((1ll)<<i))s1++;
			if (su&1)ans=ans-an[s1];else ans=ans+an[s1];
		}
	}
	cout<<ans<<endl;
	return 0;
}