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 ll long long
#define all(aaa) aaa.begin(), aaa.end()

const int N = 51, B = 18, M = (1 << B);
int a[N], b[N];
ll dp[N];
int ct = B;

int removeBit(int x, int p) {
	int res = 0, y = 0;
	for (int i = 0; i < ct; i++) {
		if (i != p) {
			res |= (((x >> i) & 1) << y);
			y++;
		}
	}
	return res;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n, k, s, t;
	cin >> n >> k >> s >> t;

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	for (int i = B - 1; i >= 0; i--) {
		int x = (s >> i) & 1,
			y = (t >> i) & 1;

		if (x > y) {
			cout << "0\n";
			return 0;
		}

		if (x == 1) {
			int new_n = 0;
			for (int j = 0; j < n; j++) {
				if ((a[j] >> i) & 1)
					a[new_n++] = removeBit(a[j], i);
			}
			n = new_n;
			ct--;
		}
		
		if (y == 0) {
			int new_n = 0;
			for (int j = 0; j < n; j++) {
				if (((a[j] >> i) & 1) == 0)
					a[new_n++] = removeBit(a[j], i);
			}
			n = new_n;
			ct--;
		}
	}

	ll ans = 0;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			b[j] = (a[i] ^ a[j]);
		}

		for (int j = 0; j < (1 << ct); j++) {
			memset(dp, 0, sizeof(dp));
			dp[1] = 1;

			for (int h = i + 1; h < n; h++) {
				if ((b[h] & j) == 0) {
					for (int z = k - 1; z > 0; z--) {
						dp[z + 1] += dp[z];
					}
				}
			}
			int p = 0;
			for (int h = 0; h < ct; h++)
				p ^= (j >> h);

			ll cur = 0;
			for (int h = 1; h <= k; h++)
				cur += dp[h];

			if (p & 1)
				ans -= cur;
			else
				ans += cur;
		}
	}

	cout << ans;

	return 0;
}