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;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k, s, t;
    cin >> n >> k >> s >> t;
    vector<int> a;
    for (int i = 0; i < n; i++) {
        int b;
        cin >> b;
        if ((b & s) == s && (b | t) == t) {
            a.emplace_back(b);
        }
    }
    if ((t & s) != s) {
        cout << 0 << '\n';
        return 0;
    }
    debug(a);
    ll ans = 0;
    n = a.size();
    vector<vector<ll>> C(n + 1, vector<ll>(n + 1));
    for (int i = 0; i <= n; i++) {
        C[i][0] = 1;
        for (int j = 1; j <= i; j++) {
            C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
        }
    }
    vector<ll> w(n + 1);
    for (int i = 0; i <= n; i++) {
        for (int j = 1; j <= min(k, i); j++) {
            w[i] += C[i][j];
        }
    }
    for (int i = 0; i < (1 << 18); i++) {
        if ((s & i) != s || (t | i) != t) {
            continue;
        }
        ll sgn = 1;
        if (__builtin_popcount(i) % 2 == 1) {
            sgn = -1;
        }
        vector<int> b(n);
        for (int j = 0; j < n; j++) {
            b[j] = a[j] & i;
        }
        sort(b.begin(), b.end());
        int j = 0;
        while (j < n) {
            int l = j;
            while (l + 1 < n && b[l] == b[l + 1]) {
                l++;
            }
            ans += sgn * w[l - j + 1];
            j = l + 1;
        } /*
        for (int j = 0; j < n; j++) {
            int l = j;
            if (j + 1 < n && b[j] == b[j + 1]) {
                j++;
            }
            ans += sgn * w[j - l + 1];
        }*/
    }
    cout << abs(ans) << '\n';
    return 0;
}