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;
int n,k,s,t;
long long a[55],ans;
long long c[55][55];
vector<long long> g[22],f[22],one,zero;
long long num[55],ban[55];
long long eval(long long x,long long y)
{
	if (y>x) return 1ll<<x;
	else
	{
		long long res=0;
		for (int i=0;i<=y;i++) res+=c[x][i];
		return res;
	}
}
long long doit(int mask)
{
	map<int,long long> mp;
	for (long long i=1;i<=n;i++)
	{
		if (!ban[i])
		{
			mp[a[i]&mask]++;
		}
	}
	long long res=0;
	for (map<int,long long>::iterator it=mp.begin();it!=mp.end();it++)
	{
		res+=(eval(it->second,k)-1);
	}
	res++;
	return res;
}
int main()
{
	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 (a[i]&(1<<j)) g[j].push_back(i);
			else f[j].push_back(i);
		}
	}
	c[0][0]=1;
	for (int i=1;i<=n;i++)
	{
		c[i][0]=1;
		for (int j=1;j<=i;j++)
		{
			c[i][j]=c[i-1][j]+c[i-1][j-1];
		}
	}
	if ((t&s)!=s)
	{
		printf("0\n");
		return 0;
	}
	memset(num,-1,sizeof(num));
	for (int i=0;i<18;i++)
	{
		if (s&(1<<i)) 
		{
			one.push_back(i);
			num[i]=1;
		}
		if ((t&(1<<i))==0) 
		{
			zero.push_back(i);
			num[i]=0;
		}
	}
	for (int i=0;i<18;i++)
	{
		if (num[i]==0)
		{
			for (int j=1;j<=n;j++)
			{
				if (a[j]&(1<<i)) ban[j]=1;
			}
		}
		if (num[i]==1)
		{
			for (int j=1;j<=n;j++)
			{
				if (!(a[j]&(1<<i))) ban[j]=1;
			}
		}
	}
	for (int i=0;i<(1<<18);i++)
	{
		bool fuck=1;
		for (int j=0;j<18;j++)
		{
			if ((i&(1<<j)) && num[j]!=-1) fuck=0;
		}
		if (!fuck) continue;
		if (__builtin_popcount(i)&1) ans-=doit(i);
		else ans+=doit(i);
	}
	printf("%lld\n",ans);
	return 0;
}