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;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
int n,k,s,t;
vector<int> a;
ll C[55][55],ways[55];
int main()
{
	scanf("%d%d%d%d",&n,&k,&s,&t);
	for(int i=0;i<n;i++)
	{
		int x;
		scanf("%d",&x);
		if(((x&s)==s)&&((x|t)==t))a.push_back(x);
	}
	if(a.empty())
	{
		printf("0\n");
		return 0;
	}
	
	C[0][0]=1;
	for(int i=1;i<55;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];
	}
	for(int i=1;i<55;i++)
	{
		for(int j=1;j<=i&&j<=k;j++)ways[i]+=C[i][j];
	}
	int free=(s^t);
	ll ans=0;
	for(int msk=0;msk<(1<<18);msk++)
	{
		if((msk&free)!=msk)continue;
		vector<int> b;
		b.clear();
		for(int i=0;i<a.size();i++)
		{
			b.push_back(a[i]&msk);
		}
		sort(b.begin(),b.end());
		ll tmp=0;
		for(int i=0,j=0;i<b.size();i=j+1)
		{
			while(j+1<b.size()&&(b[j+1]==b[i]))j++;
			tmp+=ways[j-i+1];
		}
		int bi=__builtin_popcount(msk);
		if(bi&1)ans-=tmp;
		else ans+=tmp;
	}
	printf("%lld\n",ans);
	return 0;
}