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
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <queue>
#include <vector>

using namespace std;

constexpr static int MAXN = 50;
constexpr static int MAXA = (1 << 18);

int n, k, S, T;
int a[MAXN], b[MAXN];
int64_t choose[MAXN + 1][MAXN + 1];
int64_t nsubsets[MAXN + 1];

int64_t calc() {
    if ((S | T) != T)
        return 0;

    int m = 0;
    for (int i = 0; i < n; i++)
        if ((a[i] & S) == S && (a[i] | T) == T)
            b[m++] = a[i];

    // for each mask subset, count subsets that have same bits, use PIE
    int64_t total = 0;
    for (int mask = 0; mask < MAXA; mask++) {
        if ((mask | (S ^ T)) != (S ^ T))
            continue;
        map <int, int> cnt;
        for (int i = 0; i < m; i++)
            cnt[b[i] & mask]++;

        int64_t nsame = 0;
        for (auto kv : cnt) {
            // cout << kv.second << " ";
            nsame += nsubsets[kv.second];
        }
        // cout << endl;

        int bits = __builtin_popcount(mask);
        if (bits % 2 == 0)
            total += nsame;
        else
            total -= nsame;
    }
    return total;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> k >> S >> T;
    for (int i = 0; i < n; i++)
        cin >> a[i];

    choose[0][0] = 1;
    for (int i = 1; i <= n; i++) {
        choose[i][0] = choose[i][i] = 1;
        for (int j = 1; j < i; j++)
            choose[i][j] = choose[i - 1][j] + choose[i - 1][j - 1];
    }
    for (int i = 1; i <= n; i++) {
        nsubsets[i] = 0;
        for (int j = 1; j <= k && j <= i; j++)
            nsubsets[i] += choose[i][j];
    }

    cout << calc() << endl;
}
