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;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,K,S,T; cin >> N >> K >> S >> T;
    vector<int> A;
    for (;N--;){
        int a; cin >> a;
        bool ok=true;
        for (int j=0;j<18;++j){
            if ((S&1<<j)&&!(a&1<<j)) ok=false;
            if (!(T&1<<j)&&(a&1<<j)) ok=false;
        }
        if (ok) A.emplace_back(a);
    }
    vector<int> diff;
    for (int i=0;i<18;++i){
        if ((S&1<<i)&&!(T&1<<i)){
            cout << 0 << '\n';
            return 0;
        }
        if (!(S&1<<i)&&(T&1<<i)) diff.emplace_back(i);
    }
    N=A.size();
    vector<vector<ll>> choose(N+1,vector<ll>(N+1,0));
    for (int i=1;i<=N;++i){
        choose[i][0]=1;
        for (int j=0;j<min(K,i);++j) choose[i][j+1]=choose[i][j]*(i-j)/(j+1);
        for (int j=0;j<N;++j) choose[i][j+1]+=choose[i][j];
    }
    int M=diff.size();
    ll ans=0;
    for (int mask=0;mask<(1<<M);++mask){
        map<int,int> mp;
        for (int i=0;i<N;++i){
            int cnt=0;
            for (int j=0;j<M;++j) if (mask&1<<j){
                cnt|=((A[i]&1<<diff[j])>>diff[j])<<j;
            }
            ++mp[cnt];
        }
        int flag=__builtin_popcount(mask);
        for (auto p:mp){
            if (flag&1) ans-=choose[p.second][min(N,K)]-1;
            else ans+=choose[p.second][min(N,K)]-1;
        }
    }
    cout << ans << '\n';
}