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;
const int maxn=(1<<18)+10;
int n,k,s,t,m;
vector<int> a;
ll C[55][55],ways[55];
ll cnt[maxn];
void solve()
{
	for(int i=0;i<m;i++)
	{
		for(int msk=0;msk<(1<<m);msk++)
		{
			if(!(msk>>i&1))
			{
				cnt[msk^(1<<i)]+=cnt[msk];
			}
		}
	}
}
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;
	}
	n=a.size();
	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=0;i<55;i++)
	{
		for(int j=0;j<=i&&j<k;j++)ways[i]+=C[i][j];
	//	if(i<=n)cout<<i<<" "<<ways[i]<<endl;
	}
	int free=(s^t);
	vector<int> bts;
	bts.clear();
	for(int i=0;i<18;i++)if(free>>i&1)bts.push_back(i);
	m=bts.size();
	for(int i=0;i<n;i++)
	{
		int tmp=a[i];
		a[i]=0;
		for(int j=0;j<m;j++)if(tmp>>bts[j]&1)a[i]|=(1<<j);
	//	cout<<a[i]<<endl;
	}
	ll ans=0;
	int s2=__builtin_popcount(s);
	for(int i=0;i<n;i++)
	{
		memset(cnt,0,sizeof(cnt));
		for(int j=i+1;j<n;j++)
		{
			cnt[a[i]^a[j]]++;
		}
	//	for(int j=0;j<(1<<m);j++)cout<<cnt[j]<<endl;system("pause");
		solve();
		for(int j=0;j<(1<<m);j++)
		{
			int sz=__builtin_popcount(j);
			if(sz&1)ans-=ways[cnt[j]];
			else ans+=ways[cnt[j]];
		}
	}
	if(m&1)
	{
		ans=-ans;
	//	cout<<__builtin_popcount(s)<<" "<<__builtin_popcount(t)<<" "<<m<<" "<<__builtin_popcount(free)<<endl;
	}
	printf("%lld\n",ans);
	return 0;
}