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;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

ll comb[53][53];
ll combsum[53][53];
void make_table(){
  for(ll i=0;i<=51;i++){
    comb[i][0]=1;
    comb[i][i]=1;
  }
  for(ll i=1;i<=51;i++)for(ll j=1;j<i;j++){
    comb[i][j]=(comb[i-1][j-1]+comb[i-1][j]);
  }
}

ll cnt0[(1<<18)];
ll cnt1[(1<<18)];
ll pcnt[(1<<18)],sgn[(1<<18)];

ll bitv(ll a, ll n){
  return (a>>n)&1LL;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  make_table();
  rep(i,52){
    rep(j,52){
      combsum[i][j+1]=combsum[i][j]+comb[i][j];
    }
  }

  const ll B=18;
  rep(i,1<<B){
    pcnt[i]=bcnt(i);
    if(pcnt[i]%2==1) sgn[i]=-1;
    else sgn[i]=+1;
  }

  ll N,K,S,T;
  cin>>N>>K>>S>>T;
  vector<ll> A(N);
  rep(i,N)cin>>A[i];
  vector<ll> tmp;
  ll mask=(1<<B)-1;
  rep(j,B){
    if(bitv(S,j)==1&&bitv(T,j)==0){
      cout<<0<<endl;
      return 0;
    }
  }
  rep(j,B){
    if(bitv(S,j)==1||bitv(T,j)==0){
      mask^=(1LL<<j);
    }
  }
  //dbg(mask);
  rep(i,N){
    bool ok=true;
    rep(j,B){
      if(bitv(S,j)==1&&bitv(A[i],j)==0){
        ok=false;
      }
      if(bitv(T,j)==0&&bitv(A[i],j)==1){
        ok=false;
      }
    }
    if(ok){
      tmp.push_back(A[i]);
    }
  }
  A=tmp;
  N=A.size();
  //dbg(N);

  rep(i,N)A[i]=(A[i]&mask);


  ll res=0;
  rep(U,1<<B){
    if((U|mask)!=mask)continue;
    map<ll,ll> cnt;
    rep(i,N){
      ll s=(U&A[i]);
      cnt[s]++;
    }
    for(P p : cnt){
      res+=(combsum[p.se][K+1]-1)*sgn[U];
    }
  }
  cout<<res<<endl;

  return 0;
}