#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], pre[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];
		pre[i][1] = binom[i][1];
		for (int j = 2; j < MAXN; ++j) pre[i][j] = pre[i][j - 1] + binom[i][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);
	ll ans = 0;
	vector<int> cnt(req);
	for (int b = 0; b < req; ++b) {
		for (int x : B) {
			cnt[x & b]++;
		}
		ll t = 0;
		for (int x : B) {
			t += pre[cnt[x & b]][k];
			cnt[x & b] = 0;
		}
		if (__builtin_popcount(b) & 1) ans -= t;
		else ans += t;
	}
	printf("%lld\n", ans);
}
