#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>
#include<cassert>
#include<functional>
#include<unordered_map>
#include<deque>
#include<cmath>





using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<double, double> pdd;

#define show(x) cerr << x
#define debug(x) show(#x << ": " << (x) << endl)

const long double PI = 3.14159265358979323846;
const long double eps = 1e-5;
const ll INF = numeric_limits<int>::max();
const ll LINF = numeric_limits<ll>::max();
const ll mod = 1000 * 1000 * 1000 + 7;


void solve(vector<int> b, int k, int sz) {
    int n = b.size();
    ll res = 0;
    vector<vector<ll> > c(55, vector<ll>(55, 0));
    c[0][0] = 1;
    for (int i = 1; i < c.size(); ++i) {
        c[i][0] = c[i][i] = 1;
        for (int j = 1; j < i; ++j) {
            c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
        }
    }
    vector<ll> ans(n + 1, 0);
    for (int i = 0; i <= n; ++i) {
        for (int j = 0; j < k; ++j) {
            ans[i] += c[i][j];
        }
    }
    for (int f = 0; f < b.size(); ++f) {
        vector<ll> a;
        ll st = (1LL << n) - (1LL << (f + 1));
        for (int j = 0; j < sz; ++j) {
            ll x = 0;
            for (int i = f + 1; i < n; ++i) {
                if ((((b[i] ^ b[f]) >> j) & 1) == 0)
                    x += (1LL) << i;
            }
            a.push_back(x);
        }
        for (int m = 0; m < (1 << sz); ++m) {
            ll x = st;
            int sm = 0;
            for (int j = 0; j < sz; ++j) {
                if ((m >> j) & 1) {
                    sm++;
                    x = x & a[j];
                }
            }
            int ones = 0;
            while (x) {
                ones += x & 1;
                x /= 2;
            }
            if (sm & 1)
                res -= ans[ones];
            else res += ans[ones];
        }
    }
    cout << res << "\n";
}

void solve() {
    int n, k, s, t;
    cin >> n >> k >> s >> t;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<int> good(n, 1);
    vector<int> intBits;
    for (int j = 0; j < 18; ++j) {
        int ss = (s >> j) & 1, tt = (t >> j) & 1;
        if ((ss == 1) && (tt == 0)) {
            cout << 0 << "\n";
            return;
        }
        if ((ss == 1) && (tt == 1)) {
            for (int i = 0; i < n; ++i) {
                if (((a[i] >> j) & 1) == 0)
                    good[i] = 0;
            }
        }
        if ((ss == 0) && (tt == 0)) {
            for (int i = 0; i < n; ++i) {
                if (((a[i] >> j) & 1) == 1)
                    good[i] = 0;
            }
        }
        if ((ss == 0) && (tt == 1)) {
            intBits.push_back(j);
        }
    }
    vector<int> b;
    
    for (int i = 0; i < n; ++i) {
        if (good[i] == 0)
            continue;
        int x = 0;
        for (int j = 0; j < intBits.size(); ++j) {
            x += ((a[i] >> intBits[j]) & 1) << j;
        }
        b.push_back(x);
    }
    solve(b, k, intBits.size());

}


//#define LOCAL

int main() {
    ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    solve();



#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif	
    return 0;
}


Measured memory_bytes: 3232