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 lowbit(x) ((x)&(-(x)))
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 0x3f3f3f3f;
const LL LINF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;
const int maxn = 3e5 + 10;
int N, K, S, T, A[55];
int M, L, B[55];
LL Comb[55][55];
void preprocess()
{
    for(int i = 0; i <= N; i++)
		Comb[i][0] = 1;
	for(int i = 1; i <= N; i++)
		for(int j = 1; j <= i; j++)
			Comb[i][j] = Comb[i-1][j] + Comb[i-1][j-1];
    for(int i = 1; i <= N; i++)
    {
        bool ok = true;
        int X = 0;
        for(int j = 17; j >= 0; j--)
        {
            int s = (S >> j) & 1, t = (T >> j) & 1, a = (A[i] >> j) & 1;
            if((!s && !t && a) || (s && t && !a) || (s && !t))
            {
                ok = false;
                break;
            }
            if(!s && t)
                X = (X << 1) ^ a;
        }
        if(ok)
            B[++M] = X;
    }
    for(int i = 17; i >= 0; i--)
    {
        int s = (S >> i) & 1, t = (T >> i) & 1;
        if(!s && t)
            L++;
    }
    K = min(K, M);
}
set<int> st;
int cnt[maxn];
LL calc(int X)
{
    st.clear();
    for(int i = 1; i <= M; i++)
    {
        st.insert(B[i] & X);
        cnt[B[i] & X]++;
    }
    LL res = 0;
    for(auto Y : st)
    {
        for(int i = 1; i <= min(K, cnt[Y]); i++)
            res += Comb[cnt[Y]][i];
        cnt[Y] = 0;
    }
    return res;
}
int bit_count(int X)
{
    int C = 0;
    while(X)
    {
        C += X & 1;
        X >>= 1;
    }
    return C;
}
int main()
{
    scanf("%d %d %d %d", &N, &K, &S, &T);
    for(int i = 1; i <= N; i++)
        scanf("%d", &A[i]);
    preprocess();
    LL ans = 0;
    for(int X = 0; X < (1 << L); X++)
    {
        if(bit_count(X) & 1)
            ans -= calc(X);
        else
            ans += calc(X);
    }
    printf("%lld\n", ans);
    return 0;
}