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;
const int MAXN = 55;
const int MAXV = 1 << 18;
typedef long long ll;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
ll coef[MAXN], binom[MAXN][MAXN];
int cnt[MAXV], bits[MAXV];
int m, goal, n, k, s, t, bit[MAXN], a[MAXN];
bool inc(int x, int y) {
	return (x | y) == x;
}
void FWTOR(int *a, int N) {
	for (int len = 2; len <= N; len <<= 1)
	for (int s = 0; s < N; s += len)
	for (int i = s, j = s + len / 2; j < s + len; i++, j++)
		a[i] = a[i] + a[j];
}
int main() {
	read(m), read(k), read(s), read(t);
	if (!inc(t, s)) {
		puts("0");
		return 0;
	}
	for (int i = 1; i <= m; i++) {
		int x; read(x);
		if (inc(x, s) && inc(t, x)) a[++n] = x;
	}
	m = 0, goal = 0;
	for (int i = 1; i <= 18; i++) {
		bit[i] = 1 << (i - 1);
		if ((t & bit[i]) && (s & bit[i]) == 0) m++, goal = goal * 2 + 1;
	}
	for (int i = 1; i <= n; i++) {
		int res = 0;
		for (int j = 1; j <= 18; j++)
			if ((t & bit[j]) && (s & bit[j]) == 0) {
				if (a[i] & bit[j]) res = res * 2 + 1;
				else res = res * 2;
			}
		a[i] = res;
	}
	for (int i = 0; i <= n; i++) {
		binom[i][0] = 1;
		for (int j = 1; j <= i; j++)
			binom[i][j] = binom[i - 1][j - 1] + binom[i - 1][j];
		for (int j = 0; j <= k - 1; j++)
			coef[i] += binom[i][j];
	}
	for (int i = 1; i <= goal; i++)
		bits[i] = bits[i / 2] + i % 2;
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		memset(cnt, 0, sizeof(cnt));
		for (int j = i + 1; j <= n; j++)
			cnt[a[i] ^ a[j] ^ goal]++;
		FWTOR(cnt, goal + 1);
		for (int j = 0; j <= goal; j++)
			if (bits[j] & 1) ans -= coef[cnt[j]];
			else ans += coef[cnt[j]];
	}
	cout << ans << endl;
	return 0;
}