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 <algorithm>
#include <array>
#include <cassert>
#include <iostream>
#include <vector>
using namespace std;

template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

#ifdef NEAL_DEBUG
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif


const int BITS = 18;

int main() {
    int N, K, S, T;
    cin >> N >> K >> S >> T;

    if ((S | T) != T) {
        cout << 0 << '\n';
        return 0;
    }

    vector<int> A;

    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;

        if ((a & S) != S || (a | T) != T)
            continue;

        A.push_back(a);
    }

    N = int(A.size());
    K = min(K, N);

    vector<vector<int64_t>> choose(N + 1, vector<int64_t>(N + 1, 0));

    for (int i = 0; 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];
    }

    vector<int64_t> up_to_K(N + 1, 0);

    for (int i = 1; i <= N; i++)
        for (int j = 1; j <= K; j++)
            up_to_K[i] += choose[i][j];

    vector<int> freq(1 << BITS, 0);
    int64_t answer = 0;
    int overall = S ^ T;

    for (int mask = overall; ; mask = (mask - 1) & overall) {
        for (int &a : A)
            freq[a & mask]++;

        int64_t sum = 0;

        for (int &a : A) {
            sum += up_to_K[freq[a & mask]];
            freq[a & mask] = 0;
        }

        answer += (__builtin_popcount(mask) % 2 == 0 ? +1 : -1) * sum;

        if (mask == 0)
            break;
    }

    cout << answer << '\n';
}