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 all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
const int maxn = 1<<18, mod = 1e9 + 7;
ll C[60][60];
void precalc() {
	for(int i = 0; i < 55; i++)
		for(int j = 0; j <= i; j++) {
			if(!j) C[i][j] = 1;
			else C[i][j] = C[i-1][j] + C[i-1][j-1];
		}
}
ll nck(int n, int k) {
	if(n < k || k < 0) return 0;
	return C[n][k];
}

int n, k, s, t;
ll ans = 0;
ll a[maxn], A[maxn];
void transform() {
	for(int j = 0; j < 18; j++)//relax i-th bit
		for(int i = 0; i < maxn; i++) {
			if(i&(1<<j)) a[i] += a[i ^ (1<<j)];
		}
	for(int i = 0; i < maxn; i++)
		for(int j = 0; j < k; j++)
			A[i] += nck(a[i], j);
	for(int j = 0; j < 18; j++)//fix i-th bit
		for(int i = 0; i < maxn; i++)
			if(i&(1<<j)) A[i] -= A[i ^ (1<<j)];
}

int main() {
	cin.tie(0)->sync_with_stdio(0);
	precalc();
	cin >> n >> k >> s >> t;
	if((s&t) != s) return cout << 0, 0;
	int M = s^t;
	vector<int> v;
	for(int x, i = 0; i < n; i++) {
		cin >> x;
		if((x&s) == s && (x&t) == x) v.pb(x&M);
	}
	n = v.size();
	for(int i = 0; i < n; i++) {
		memset(a, 0, sizeof a);
		memset(A, 0, sizeof A);
		for(int j = i+1; j < n; j++) {
			a[v[j]^v[i]]++;
		}
		transform();
		ans += A[M];
	}
	cout << ans;
	return 0;
}