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(0);
	cin.tie(0); cout.tie(0);
	const int N = 55;
	vector<vector<long long>> C(N, vector<long long>(N, 0));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= i; j++) {
			if (i == j || j == 0) C[i][j] = 1;
			else C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
		}
	}
	int n, k, S, T; cin >> n >> k >> S >> T;
	vector<int> a;
	for (int i = 0; i < n; i++) {
		int b; cin >> b;
		if ((b & S) != S) continue;
		if ((b | T) != T) continue;
		a.push_back(b);
	}
	n = a.size();
	vector<int> bts;
	bool flag = true;
	for (int i = 0; i < 18; i++) {
		if ((S >> i & 1) && (~T >> i & 1)) flag = false;
		if ((~S >> i & 1) && (T >> i & 1)) {
			bts.push_back(i);
		}
	}
	int m = bts.size();
	vector<long long> nums(m, 0);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (a[i] >> bts[j] & 1) nums[j] |= 1ll << i;
		}
	}
	long long ans = 0;
	if (flag) {
		long long tot = 0;
		vector<int> add(n + 1, 0), del(n + 1, 0);
		vector<vector<long long>> st(1 << m);
		st[0].push_back((1ll << n) - 1);
		for (int i = 1; i < (1 << m); i++) {
			int bc = __builtin_popcount(i);
			for (int j = 0; j < m; j++) {
				if (i >> j & 1) {
					for (auto val : st[i ^ (1 << j)]) {
						if (val & nums[j]) st[i].push_back(val & nums[j]);
						if (val & (~nums[j])) st[i].push_back(val & (~nums[j]));
					}
					break;
				}
			}
			long long sgn = 1;
			if (bc & 1) sgn = -1;
			for (auto val : st[i]) {
				bc = __builtin_popcountll(val);
				if (sgn > 0) add[bc]++;
				else del[bc]++;
//				tot += sgn * C[bc][c];
			}
		}
		for (int c = 1; c <= min(n, k); c++) {
			tot += C[n][c];
			for (int i = 0; i <= n; i++) {
				tot += C[i][c] * (add[i] - del[i]);
			}
		}
		ans += tot;
	}
	cout << ans << endl;
	return 0;
}