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 <iostream>
#include <map>
using namespace std;
typedef long long ll;

ll com[52][52];
ll c[52][52];

int main()
{
    int n, k, s, t;
    cin >> n >> k >> s >> t;
    int a[52];
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if((a[i] & t) < a[i] || (a[i] | s) > a[i]){
            i--;
            n--;
        }
    }
    com[0][0] = 1;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            com[i + 1][j] += com[i][j];
            com[i + 1][j + 1] += com[i][j];
        }
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= i; j++){
            c[i][j] = c[i][j - 1] + com[i][j];
        }
    }
    int l = 0;
    int r[52]{0};
    for(int i = 0; i < 18; i++){
        if(((s >> i) & 1) == 1 && ((t >> i) & 1) == 0){
            cout << 0 << endl;
            return 0;
        }
        if(((s >> i) & 1) == 0 && ((t >> i) & 1) == 1){
            for(int j = 0; j < n; j++){
                if((a[j] >> i) & 1) r[j] += (1 << l);
            }
            l++;
        }
    }
    ll ans = 0;
    for(int b = 0; b < (1 << l); b++){
        map<int, int> mp;
        int d[52]{0};
        ll p = 0;
        for(int j = 0; j < l; j++){
            if((b >> j) & 1){
                p++;
                for(int i = 0; i < n; i++){
                    if((r[i] >> j) & 1) d[i] += (1 << j);
                }
            }
        }
        for(int i = 0; i < n; i++) mp[d[i]]++;
        ll s = 0;
        for(auto itr = mp.begin(); itr != mp.end(); itr++){
            s += c[itr->second][min(itr->second, k)];
        }
        if(p % 2) ans -= s;
        else ans += s;
    }
    cout << ans << endl;
}