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;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k, s, t;
	cin >> n >> k >> s >> t;
	vector<vector<long long>> dp(n + 1, vector<long long> (k + 1, 0));
	dp[0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= k; j++) {
			dp[i + 1][j] += dp[i][j];
			if (j + 1 <= k) dp[i + 1][j + 1] += dp[i][j];
		}
	}
	for (int i = 0; i <= n; i++) {
		for (int j = 2; j <= k; j++) {
			dp[i][j] += dp[i][j - 1];
		}
	}
	vector<int> old_a(n);
	for (int i = 0; i < n; i++) {
		cin >> old_a[i];
	}
	if ((s & t) != s) {
		cout << "0\n";
		return 0;
	}
	vector<int> a;
	for (int i = 0; i < n; i++) {
		if ((old_a[i] & s) != s || (old_a[i] & t) != old_a[i]) continue;
		a.push_back(old_a[i]);
	}
	n = a.size();
	long long ans = 0;
	for (int i = 0; i < (1 << 18); i++) {
		if ((i & s) || (i & t) != i) continue;
		int sign = __builtin_popcount(i);
		if (sign & 1) sign = -1;
		else sign = 1;
		vector<int> cur;
		for (int j = 0; j < n; j++) {
			cur.push_back(a[j] & i);
		}
		sort(cur.begin(), cur.end());
		for (int j = 0, x = 0; j < n; j = x) {
			for (; x < n && cur[x] == cur[j]; x++);
			ans += dp[x - j][k] * sign;
		}
	}
	cout << ans << '\n';
	return 0;
}