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:
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, k, s, t, a[55];
long long ans, candi[2][18], combi[60][60], F[60];
vector<int> vec;

int cnt_bit(long long x)
{
	int cnt = 0;
	while (x) {
		if (x & 1) cnt++;
		x = x >> 1;
	}
	return cnt;
}

void fun(int cur, int sign, long long res, int v)
{
	if (cur == 18) {
		int tmp = cnt_bit(res);
		ans += sign * F[tmp];
	}
	else {
		if (((t >> cur) & 1) ^ ((s >> cur) & 1)) {
			if ((v >> cur) & 1) {
				fun(cur + 1, sign, res, v);
				fun(cur + 1, -sign, res & candi[1][cur], v);
			}
			else {
				fun(cur + 1, sign, res, v);
				fun(cur + 1, -sign, res & candi[0][cur], v);
			}
		}
		else fun(cur + 1, sign, res, v);
	}
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	for (int i = 1; i <= 50; i++) combi[i][0] = 1;
	combi[1][1] = 1;
	for (int i = 2; i <= 50; i++) {
		for (int j = 1; j <= i; j++) {
			combi[i][j] = combi[i - 1][j] + combi[i - 1][j - 1];
		}
	}
	cin >> n >> k;
	cin >> s >> t;
	for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 1; i <= 50; i++) {
		for (int j = 1; j <= min(i, k - 1); j++) {
			F[i] += combi[i][j];
		}
	}
	if (((s & t) != s) || ((s | t) != t)) {
		cout << 0 << E;
	}
	else {
		for (int i = 0; i < n; i++) {
			if ((a[i] & s) != s) continue;
			if ((a[i] | t) != t) continue;
			vec.pb(a[i]);
		}
		int sz = vec.size();
		for (int i = 0; i < sz; i++) {
			if (s == t && vec[i] == t) {
				ans++;
			}
			memset(candi, 0, sizeof(candi));
			for (int j = 0; j < i; j++) {
				for (int u = 0; u < 18; u++) {
					candi[(vec[j] >> u) & 1][u] += 1LL << j;
				}
			}
			fun(0, 1, (1LL << i) - 1, vec[i]);
		}
		cout << ans << E;
	}
	//system("pause");
	return 0;
}