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>
typedef long long ll;
typedef long double ld;
using namespace std;
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
#define int ll

bool sub(int a, int b) {
  return (a | b) == b;
}

const int N = 55;
const int M = (1 << 18);
int kek[M], fbit[M], C[N][N], a[N], b[N], cur[N], calc[N];

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  C[0][0] = 1;
  for (int i = 1; i <= 50; i++) {
    C[i][0] = 1;
    for (int j = 1; j <= i; j++) {
      C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
    }
  }
  int n, k, s, t;
  cin >> n >> k >> s >> t;
  if (!sub(s, t)) {
    cout << 0 << '\n';
    exit(0);
  } 
  int tn = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (sub(s, a[i]) && sub(a[i], t)) {
      b[tn++] = a[i];
    }
  }
  n = tn;
  vector<int> bts;
  for (int i = 0; i < 18; i++) {
    if (((s ^ t) >> i) & 1) {
      bts.pb(i);
    }
  }
  for (int i = 0; i < n; i++) {
    int vl = 0;
    for (int j = 0; j < SZ(bts); j++) {
      if ((b[i] >> bts[j]) & 1) {
        vl |= 1 << j;
      }
    }
    b[i] = vl;
  }
  int L = SZ(bts);
  int ans = 0;
  for (int mask = 1; mask < (1 << L); mask++) {
    for (int i = 0; i < L; i++) {
      if ((mask >> i) & 1) {
        fbit[mask] = i;
        break;
      }
    }
  }
  //0..k - 1
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < k; j++) {
      calc[i] += C[i][j];
    }
  }
  kek[0] = (1ll << n) - 1;
  for (int fpos = 0; fpos < n; fpos++) {
    for (int j = 1; j < (1 << L); j++) {
      kek[j] = 0;
    }
    for (int i = fpos + 1; i < n; i++) {
      cur[i] = b[fpos] ^ b[i];
      for (int j = 0; j < L; j++) {
        if (!((cur[i] >> j) & 1)) {
          kek[1 << j] |= 1ll << i;
        } 
      }
    }
    int add = calc[n - fpos - 1];
    for (int mask = 1; mask < (1 << L); mask++) {
      kek[mask] = kek[mask ^ (1 << fbit[mask])] & kek[1 << fbit[mask]];
      if (__builtin_popcount(mask) & 1) {
        add -= calc[__builtin_popcountll(kek[mask])];
      } 
      else {
        add += calc[__builtin_popcountll(kek[mask])];
      }
    }
    ans += add;
  }
  cout << ans << '\n';
}