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 <cmath>
#include <functional>
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>

using namespace std;

typedef long long ll;

#ifdef iq
  mt19937 rnd(228);
#else
  mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

int s, t;

ll ok[18][2];
ll comb[51][51];
ll f[51];

ll ans = 0;

void brute(int bit, int sign, ll cands) {
  if (bit == 18) {
    ans += f[__builtin_popcountll(cands)] * sign;
  } else {
    if (((s >> bit) & 1) == ((t >> bit) & 1)) {
      brute(bit + 1, sign, cands);
    } else {
      brute(bit + 1, sign, cands);
      brute(bit + 1, -sign, cands & ok[bit][0]);
      brute(bit + 1, -sign, cands & ok[bit][1]);
    }
  }
}

int main() {
#ifdef iq
  freopen("a.in", "r", stdin);
#endif
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  cin >> s >> t;
  comb[0][0] = 1;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      if (i) comb[i][j] += comb[i - 1][j];
      if (i && j) comb[i][j] += comb[i - 1][j - 1];
    }
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      f[i] += comb[i][j];
    }
  }
  vector <int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  if ((t & s) != s) {
    cout << 0 << '\n';
    return 0;
  }
  vector <int> x;
  for (int i = 0; i < n; i++) {
    if (((a[i] & t) == a[i]) && ((a[i] | s) == a[i])) {
      x.push_back(a[i]);
    }
  }
  a = x;
  n = (int) a.size();
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 18; j++) {
      ok[j][(a[i] >> j) & 1] |= (1ll << i);
    }
  }
  brute(0, 1, (1ll << n) - 1);
  cout << ans << endl;
}