#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
void *wmem;
char memarr[96000000];
template<class T> inline void walloc1d(T **arr, int x, void **mem = &wmem){
  static int skip[16] = {0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
  (*mem) = (void*)( ((char*)(*mem)) + skip[((unsigned long long)(*mem)) & 15] );
  (*arr)=(T*)(*mem);
  (*mem)=((*arr)+x);
}
template<class T1> void sortA_L(int N, T1 a[], void *mem = wmem){
  sort(a, a+N);
}
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(long long x){
  int s=0;
  int m=0;
  char f[20];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
template<class T> int runLength(int N, T *arr, void *val_s = NULL, void *len_s = NULL){
  int i;
  int rN;
  T *val = (T*) val_s;
  int *len = (int*) len_s;
  if(N==0){
    return 0;
  }
  if(val==NULL || len==NULL){
    void *mem = wmem;
    if(val==NULL){
      walloc1d(&val, N, &mem);
    }
    if(len==NULL){
      walloc1d(&len, N, &mem);
    }
  }
  rN = 1;
  val[0] = arr[0];
  len[0] = 1;
  for(i=(1);i<(N);i++){
    if(val[rN-1] == arr[i]){
      len[rN-1]++;
    }
    else{
      val[rN] = arr[i];
      len[rN] = 1;
      rN++;
    }
  }
  return rN;
}
int N;
int K;
int A[50];
int S;
int T;
int sz;
int con[18];
int arr[50];
int val[50];
int len[50];
long long cb[51][51];
long long cbb[51];
int main(){
  int b, mask;
  wmem = memarr;
  int i;
  int j;
  int k;
  int bc;
  long long res = 0;
  rd(N);
  rd(K);
  rd(S);
  rd(T);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(N);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  for(b=(0);b<(18);b++){
    if(((S) &(1<<(b)))&& !((T) &(1<<(b)))){
      wt_L(0);
      wt_L('\n');
      return 0;
    }
    if(!((S) &(1<<(b)))&&((T) &(1<<(b)))){
      con[sz++] = b;
      continue;
    }
    if(((S) &(1<<(b)))&&((T) &(1<<(b)))){
      k = 0;
      for(i=(0);i<(N);i++){
        if(((A[i]) &(1<<(b)))){
          A[k++] = A[i];
        }
      }
      N = k;
    }
    if(!((S) &(1<<(b)))&& !((T) &(1<<(b)))){
      k = 0;
      for(i=(0);i<(N);i++){
        if(!((A[i]) &(1<<(b)))){
          A[k++] = A[i];
        }
      }
      N = k;
    }
  }
  for(i=(0);i<(N);i++){
    k = 0;
    for(j=(0);j<(sz);j++){
      if(((A[i]) &(1<<(con[j])))){
        k |= (1<<j);
      }
    }
    A[i] = k;
  }
  for(i=(0);i<(51);i++){
    cb[i][0] = 1;
  }
  for(i=(1);i<(51);i++){
    for(j=(1);j<(51);j++){
      cb[i][j] = cb[i-1][j-1] + cb[i-1][j];
    }
  }
  for(i=(0);i<(51);i++){
    for(j=(1);j<(K+1);j++){
      cbb[i] += cb[i][j];
    }
  }
  for(mask=(0);mask<(1<<sz);mask++){
    bc = 1;
    for(i=(0);i<(sz);i++){
      if(((mask) &(1<<(i)))){
        bc *= -1;
      }
    }
    for(i=(0);i<(N);i++){
      arr[i] = (A[i] & mask);
    }
    sortA_L(N,arr);
    k = runLength(N,arr,val,len);
    for(i=(0);i<(k);i++){
      res += bc * cbb[len[i]];
    }
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200509-1

// --- original code ---
// int N, K, A[50], S, T;
// int sz, con[18];
// int arr[50], val[50], len[50];
// ll cb[51][51], cbb[51];
// {
//   int i, j, k, bc;
//   ll res = 0;
//   rd(N,K,S,T,A(N));
//   rep(b,18){
//     if(BIT_ith(S,b) && !BIT_ith(T,b)) wt(0), return 0;
//     if(!BIT_ith(S,b) && BIT_ith(T,b)) con[sz++] = b, continue;
//     if(BIT_ith(S,b) && BIT_ith(T,b)){
//       k = 0;
//       rep(i,N) if(BIT_ith(A[i], b)) A[k++] = A[i];
//       N = k;
//     }
//     if(!BIT_ith(S,b) && !BIT_ith(T,b)){
//       k = 0;
//       rep(i,N) if(!BIT_ith(A[i], b)) A[k++] = A[i];
//       N = k;
//     }
//   }
// 
//   rep(i,N){
//     k = 0;
//     rep(j,sz) if(BIT_ith(A[i], con[j])) k |= (1<<j);
//     A[i] = k;
//   }
// 
// //  wt(sz);
// //  wt(A(N));
// 
//   rep(i,51) cb[i][0] = 1;
//   rep(i,1,51) rep(j,1,51) cb[i][j] = cb[i-1][j-1] + cb[i-1][j];
//   rep(i,51) rep(j,1,K+1) cbb[i] += cb[i][j];
// 
//   rep(mask,1<<sz){
//     bc = 1;
//     rep(i,sz) if(BIT_ith(mask,i)) bc *= -1;
//     rep(i,N) arr[i] = (A[i] & mask);
//     sortA(N,arr);
//     k = runLength(N,arr,val,len);
//     rep(i,k) res += bc * cbb[len[i]];
//   }
// 
//   wt(res);
// }


Measured memory_bytes: 3604