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 For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 51;
int n,m,s,t,b[N],cnt,a[N];

ll C[N][N],pre[N][N];
inline void init(int n){
	C[0][0]=1;
	For(i,1,n){
		C[i][0]=1;
		For(j,1,i) C[i][j]=C[i-1][j-1]+C[i-1][j],pre[i][j]=pre[i][j-1]+C[i][j];
	}
}

ll ans;
bool flag[1<<18|3];
inline ll calc(int x){
	ll ret=0;
	For(i,1,cnt){
		if (flag[x&a[i]]) continue;
		int tot=0;
		For(j,i,cnt) if ((a[j]&x)==(a[i]&x)) ++tot;
		ret+=pre[tot][min(m,tot)];
		flag[x&a[i]]=1;
	}
	For(i,1,cnt) flag[x&a[i]]=0;
	return ret;
}
inline void dfs(int u,int f,int mark){
	if (u==18){
		ans+=f*calc(mark);
		return;
	}
	if (!(s&(1<<u))) dfs(u+1,f,mark);
	else if (t&(1<<u)) dfs(u+1,f,mark);
	else dfs(u+1,f*(-1),mark|(1<<u)),dfs(u+1,f,mark);
}

int main(){
	n=read(),m=read(),t=read(),s=read();
	For(i,1,n) b[i]=read();
	For(i,0,17) if (!(s&(1<<i))&&(t&(1<<i))) return puts("0"),0;
	For(i,1,n){
		bool flag=1;
		For(j,0,17){
			if (!(s&(1<<j))){
				if (b[i]&1<<j) flag=0;
			} else if (t&(1<<j)){
				if (!(b[i]&(1<<j))) flag=0;
			}
		}
		if (flag) a[++cnt]=b[i];
	}
	init(cnt),dfs(0,1,0),printf("%lld\n",ans);
}