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;

#ifdef NeverBeRed
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
#define F first
#define S second



int main()
{
	#ifdef TurnRed
		//freopen("a.in", "r", stdin);
		//freopen("a.out", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	int n, k, s, t;
	cin >> n >> k >> s >> t;
	vector<int> a(n);
	for (auto &i : a) cin >> i;

	vector<int> b;
	for (auto &i : a)
		if ((i|t) == t && (i&s) == s)
			b.push_back(i);

	n = b.size();
	k = min(k, n);

	vector<vector<ll>> p(n+1, vector<ll>(n+1));
	for (int i = 0; i <= n; ++i)
	{
		p[i][0] = 1;
		for (int j = 1; j <= i; ++j)
			p[i][j] = p[i-1][j] + p[i-1][j-1];
	}

	vector<int> z(18), o(18);
	for (int i = 0; i < 18; ++i)
	{
		if (~s >> i & 1) z[i] = 1;
		if (t >> i & 1) o[i] = 1;
	}

//	debug(b);

	for (auto &i : p)
		partial_sum(i.begin(), i.end(), i.begin());

	ll ans = 0;
	for (int pos = 0; pos < n; ++pos)
	{
		int x = b[pos];

		int wtf = 0, g = 0;
		for (int i = 0; i < 18; ++i)
		{
			int w = x >> i & 1;
			if (w && z[i]) g |= 1 << i, wtf |= 1 << i;
			if (!w && o[i]) g |= 1 << i;
		}

//		debug(x, g, wtf);

		vector<int> dp(1 << 18);
		for (int pos2 = pos+1; pos2 < n; ++pos2)
			++dp[b[pos2] ^ wtf];

		for (int i = 0; i < 18; ++i)
			for (int j = 0; j < 1 << 18; ++j)
				if (~j >> i & 1)
					dp[j | 1 << i] += dp[j];

		for (int i = 1; i < 1 << 18; ++i)
		{
			if ((i|g) != g) continue;
			int sg = (__builtin_popcount(i) & 1) ? +1 : -1;

			int y = ((1 << 18) - 1) ^ i;
			ans += sg * p[dp[y]][min(k-1, dp[y])];
//			for (int w = 0; w < min(k, dp[y]+1); ++w)
//				ans += sg * p[dp[y]][w];
		}
	}
//	cout << ans << "\n";
	ans *= -1;
//	for (int i = 1; i <= k; ++i)
//		ans += p[n][i];
	ans += p[n][k] - 1;
	cout << ans << "\n";

	return 0;
}