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>
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

typedef unsigned long long ul;

const int MX = 55;
int n, k, a[MX], s, t, mk;
ul dp[1 << 18], res, c[MX][MX];

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> n >> k >> s >> t;
	mk = s ^ t;

	forn (i, MX) {
		c[i][0] = 1;

		for (int j = 1; j <= i; j++)
			c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
	}

	forn (i, MX) {
		for (int j = 1; j <= n; j++)
			c[i][j] += c[i][j - 1];
	}

	forn (i, n) {
		cin >> a[i];

		if ((a[i] & t) != a[i] || (a[i] & s) != s) {
			a[i] = -1;
		} else {
			a[i] &= mk;
		}
	}

	if ((s & t) != s) {
		cout << 0 << endl;
		return 0;
	}

	forn (i, n)	{
		if (a[i] == -1) continue;

		int off = mk ^ a[i];

		memset(dp, 0, sizeof(dp));
		for (int j = i + 1; j < n; j++)
			if (a[j] != -1)
				dp[a[j] ^ off]++;

		forn (j, 18) forn (i, (1 << 18))
			if (!(i & (1 << j)))
				dp[i] += dp[i | (1 << j)];

		forn (i, (1 << 18)) {
			if (__builtin_popcount(i) & 1) {
				res -= c[dp[i]][min(dp[i], ul(k - 1))];
			} else {
				res += c[dp[i]][min(dp[i], ul(k - 1))];
			}
		}
	}

	cout << res << endl;

	return 0;
}