#define ENABLE_DEBUG 0
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v), std::end(v)
#define REP(i, k) for (decltype(k) i = 0; i < k; i++)
#define LOOP(k) REP (ngtkana_is_a_genius, k)

using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;

template <class T, class U> using pair = std::pair<U, T>;
template <class T> using diag_pair = std::pair<T, T>;
template <class... Args> using tuple = std::tuple<Args...>;
template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;

#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/
template <usize N, class T, class... Args, std::enable_if_t<N==0, int> = 0>
auto mkvec(Args... args) {
    return T(args...);
}
template <usize N, class T, class... Args, std::enable_if_t<N!=0, int> = 0>
auto mkvec(usize sz, Args... args) {
    using value_type = std::decay_t<decltype(mkvec<N-1, T>(args...))>;
    return vec<value_type>(sz, mkvec<N-1, T>(args...));
}
template <class Begin, class End>
struct span {
    using value_type=typename Begin::value_type;

    Begin begin_;
    End end_;

    span(Begin begin__, End end__)
        :begin_(begin__), end_(end__) {}

    template<class T>
        span(T const&v,i64 l,i64 r)
        : span(std::begin(v) + l, std::begin(v) + r) {}

    auto begin() { return begin_; }
    auto end() { return end_; }
    auto begin() const { return begin_; }
    auto end() const { return end_; }
};
template <class T>
auto make_span(T const& v, usize l, usize r) {
    using iterator_type = std::decay_t<decltype(v.begin())>;
    return span<iterator_type, iterator_type>(v, l, r);
}
int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    u64 n, k, s, t;
    std::cin >> n >> k >> s >> t;
    if (s & !t) {
        std::cout << 0 << '\n';
        return 0;
    }
    vec<u64> a;
    DEBUG(n, k, s, t);
    while (n--) {
        u64 x; std::cin >> x;
        if (~x & s || x & ~t) continue;
        u64 y = 0;
        for (u64 i=0, j=0; i<18; i++) if (!(s>>i&1u) && (t>>i&1u)) {
            if (x>>i&1u) y|=1u<<j;
            j++;
        }
        a.push_back(y);
    }
    n = a.size();
    u64 sz = __builtin_popcountll(t) - __builtin_popcountll(s);
    t = (1u << sz) - 1;
    DEBUG(n, k, sz, t, a);
    if (n==0) {
        std::cout << 0 << '\n';
        return 0;
    }

    auto binom = mkvec<2, u64>(n+1, n+1);
    binom.at(0).at(0) = 1;
    for (u64 i=0; i<n; i++) {
        for (u64 j=0; j<=i; j++) {
            binom.at(i+1).at(j) += binom.at(i).at(j);
            binom.at(i+1).at(j+1) += binom.at(i).at(j);
        }
    }
    DEBUG(matrix_style(binom));

    vec<u64> f(n+1);
    for (u64 i=0; i<=n; i++) {
        for (u64 j=0; j<=std::min(i, k); j++) {
            f.at(i) += binom.at(i).at(j);
        }
    }
    for (u64& x: f) x--;
    DEBUG(f);

    vec<i64> dp(t+1);
    for (u64 i=0; i<=t; i++) {
        auto b = a;
        for (u64& x: b) x &= i;
        std::sort(ALL(b));
        DEBUG(t, b);
        for (usize l=0, r=0; l<n; l=r) {
            for (r++; r<n && b.at(l)==b.at(r); r++);
            DEBUG(l, r, make_span(b, l, r));
            dp.at(i) += f.at(r - l);
        }
    }
    DEBUG(dp);

    i64 ans = 0;
    for (u64 i=0; i<=t; i++) {
        ans += (__builtin_popcountll(i) % 2 ? -1 : 1) * dp.at(i);
    }
    std::cout << ans << '\n';
}


Measured memory_bytes: 5316