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 <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define PRIM 3
#define INF (1 << 29)
#define LINF (1LL << 60)
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028
typedef long long Int;
typedef pair<Int, Int> P;
typedef long double Real;
typedef complex<Real> CP;

vector<int> as;

Int table[55][55];
Int table_sum[55];
Int ans;

Int pop_count[1 << 18];

int main()
{
    int n, k, s, t;
    for (int i = 1; i < (1 << 18); i++)
        pop_count[i] = pop_count[i / 2] + i % 2;
    cin >> n >> k >> s >> t;
    for (int i = 0; i < 55; i++) {
        table[i][0] = 1;
        for (int j = 1; j <= i; j++) {
            table[i][j] = table[i - 1][j] + table[i - 1][j - 1];
        }
    }

    for (int i = 0; i < 55; i++) {
        for (int j = 1; j <= k; j++) {
            table_sum[i] += table[i][j];
        }
    }

    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if ((a & s) != s)
            continue;
        if ((a | t) != t)
            continue;
        as.push_back(a);
    }
    for (int i = 0; i <= t; i++) {
        if ((i & s) != s)
            continue;
        if ((i | t) != t)
            continue;
        unordered_map<int, Int> cnt;
        for (auto a : as) {
            cnt[a & i]++;
        }
        Int tmp = 0;
        for (auto p : cnt) {
            tmp += table_sum[p.second];
        }
        if (pop_count[i ^ s] % 2 == 0)
            ans += tmp;
        else
            ans -= tmp;
    }
    cout << ans << endl;
    return 0;
}