#include <bits/stdc++.h>
using namespace std;

const int MOD = 1000000007;
const int B = 14;
const int SZ = 1 << B;

long long modpow(long long a, long long e) {
    long long res = 1;
    while (e > 0) {
        if (e & 1) res = res * a % MOD;
        a = a * a % MOD;
        e >>= 1;
    }
    return res;
}

int submod(int a, int b) {
    a -= b;
    if (a < 0) a += MOD;
    return a;
}

int addmod(int a, int b) {
    a += b;
    if (a >= MOD) a -= MOD;
    return a;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, k, L, R;
    cin >> n >> k >> L >> R;

    vector<int> cnt(SZ, 0);

    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        cnt[x]++;
    }

    vector<int> fact(n + 1), invfact(n + 1);

    fact[0] = 1;
    for (int i = 1; i <= n; i++) {
        fact[i] = 1LL * fact[i - 1] * i % MOD;
    }

    invfact[n] = modpow(fact[n], MOD - 2);
    for (int i = n; i >= 1; i--) {
        invfact[i - 1] = 1LL * invfact[i] * i % MOD;
    }

    auto C = [&](int N, int K) -> int {
        if (K < 0 || K > N) return 0;
        return 1LL * fact[N] * invfact[K] % MOD * invfact[N - K] % MOD;
    };

    // SOS DP:
    // cnt[mask] = number of elements x such that x is a submask of mask.
    for (int b = 0; b < B; b++) {
        for (int mask = 0; mask < SZ; mask++) {
            if (mask & (1 << b)) {
                cnt[mask] += cnt[mask ^ (1 << b)];
            }
        }
    }

    vector<int> ways(SZ);

    // ways[mask] = number of k-subsets whose OR is a submask of mask.
    for (int mask = 0; mask < SZ; mask++) {
        ways[mask] = C(cnt[mask], k);
    }

    // Möbius inversion:
    // after this, ways[mask] = number of k-subsets whose OR is exactly mask.
    for (int b = 0; b < B; b++) {
        for (int mask = 0; mask < SZ; mask++) {
            if (mask & (1 << b)) {
                ways[mask] = submod(ways[mask], ways[mask ^ (1 << b)]);
            }
        }
    }

    int ans = 0;

    for (int mask = max(0, L); mask < SZ && mask <= R; mask++) {
        if (mask % 3 == 0) {
            ans = addmod(ans, ways[mask]);
        }
    }

    cout << ans << '\n';
    return 0;
}