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
#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[60], sz, tc, dsz;
long long comb[51][51], acc[51], occ[18][2], ans;
vector<int> vec, tmp[10], dat;

int my_popcount(long long x)
{
	int cnt = 0;
	long long cur = 1LL;
	for (int i = 0; i < 63; i++) {
		if (x & cur) cnt++;
		cur = cur << 1;
	}
	return cnt;
}

void fun(int pos, int sign, long long candi)
{
	if (pos == 18) {
		long long u = (acc[my_popcount(candi)]) * sign;
		ans += u;
		//tmp[tc].pb(u);

	}
	else {
		fun(pos + 1, sign, candi);
		fun(pos + 1, -sign, candi & (occ[pos][0]));
	}
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> k >> s >> t;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	if ((s & t) != s) {
		cout << 0 << "\n";
		return 0;
	}
	for (int i = 0; i < n; i++) {
		if (((a[i] & s) == s) && ((a[i] | t) == t)) {
			vec.pb(a[i]);
		}
	}
	sz = vec.size();
	for (int i = 0; i <= sz; i++) {
		comb[i][0] = 1;
	}
	for (int i = 1; i <= sz; i++) {
		for (int j = 1; j <= i; j++) {
			comb[i][j] = comb[i - 1][j] + comb[i - 1][j - 1];
		}
	}
	for (int i = 0; i <= sz; i++) {
		for (int j = 1; j <= min(k - 1, i); j++) {
			acc[i] += comb[i][j];
		}
	}
	
	for (int i = 0; i < sz; i++) {
		dat.clear();
		for (int j = i + 1; j < sz; j++) {
			dat.pb((vec[i] ^ vec[j]) | s | (~t));
		}
		dsz = dat.size();
		memset(occ, 0, sizeof(occ));
		for (int r = 0; r < dsz; r++) {
			for (int j = 0; j < 18; j++) {
				occ[j][(dat[r] >> j) & 1] += 1LL << r;
			}
		}
		if (s == t && vec[i] == t) ans++;
		tc = i;
		fun(0, 1, (1LL << dsz) - 1);
	}
	cout << ans << "\n";
	//system("pause");
	return 0;
}