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;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
const int MAXN = 55;
ll binom[MAXN][MAXN];
int main() {
	for (int i = 0; i < MAXN; ++i)
		for (int j = 0; j <= i; ++j)
			if (!j || j == i) binom[i][j] = 1;
			else binom[i][j] = binom[i - 1][j - 1] + binom[i - 1][j];
	int n, k, S, T;
	scanf("%d%d%d%d", &n, &k, &S, &T);
	vector<int> A(n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &A[i]);
	}
	if ((T & S) != S) {
		printf("0\n");
		return 0;
	}
	vector<int> bits;
	for (int j = 0; j < 18; ++j) {
		if ((T & (1 << j)) && !(S & (1 << j))) bits.push_back(j);
	}
	int s = bits.size();
	vector<int> B;
	for (int i = 0; i < n; ++i) {
		if (~T & A[i]) continue;
		if ((S & A[i]) != S) continue;
		int b = 0;
		for (int j = 0; j < s; ++j) {
			if (A[i] & (1 << bits[j])) b |= 1 << j;
		}
		B.push_back(b);
	}
	int req = (1 << s);
	int m = B.size();
	ll ans = 0;
	for (int i = 0; i < m; ++i) {
		vector<int> V;
		for (int j = i + 1; j < m; ++j) {
			int d = B[j] ^ B[i];
			V.push_back(d);
		}
		// 0..K-1 things ORing to req-1.
		for (int b = 0; b < req; ++b) {
			int cnt = 0;
			for (int x : V) {
				if (x & b) continue;
				++cnt;
			}
			ll t = 0;
			for (int i = 0; i < k; ++i) t += binom[cnt][i];
			if (__builtin_popcount(b) & 1) ans -= t;
			else ans += t;
		}
	}
	printf("%lld\n", ans);
}