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:
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t,class ...A> inline void read(t &x,A &...a){
	read(x);read(a...);
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

#define int long long

const int N=100,M=(1<<18)+5;
int n,m,a[N],C[N][N],k,S,T,ans,cnt[M],pos[20];
bool v[M];

signed main(){
	read(n,k,S,T);
	if((S&T)!=S) return write(0),0;
	for(int i=1;i<=n;i++){
		read(a[i]);
		if((S&a[i])==S&&(a[i]&T)==a[i]) a[++m]=a[i];
	}
	n=m;m=0;
	for(int i=0;i<18;i++) if((S>>i&1)!=(T>>i&1)) pos[m++]=i;
	for(int i=1;i<=n;i++){
		int x=0;
		for(int j=0;j<m;j++) x|=(a[i]>>pos[j]&1)<<j;
		a[i]=x;
	}
	for(int i=0;i<=n;i++){
		C[i][0]=1;
		for(int j=1;j<=i;j++) C[i][j]=C[i-1][j-1]+C[i-1][j];
	}
	for(int s=0;s<(1<<m);s++){
		long long cur=0;
		for(int i=1;i<=n;i++) cnt[a[i]&s]++;
		for(int i=1;i<=n;i++) if(!v[a[i]&s]){
			v[a[i]&s]=1;
			for(int j=1;j<=k;j++) cur+=C[cnt[a[i]&s]][j];
		}
		for(int i=1;i<=n;i++) v[a[i]&s]=cnt[a[i]&s]=0;
		ans+=__builtin_popcount(s)&1?-cur:cur;
	}
	write(ans);
}