import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.*

fun main() {
    val jin = BufferedReader(InputStreamReader(System.`in`))
    val (n, k, s, t) = jin.readLine().split(" ").map { it.toInt() }
    val choose = Array(n + 1) { LongArray(n + 1) }
    choose[0][0] = 1L
    for (a in 1..n) {
        choose[a][0] = 1L
        choose[a][a] = 1L
        for (b in 1 until a) {
            choose[a][b] = choose[a - 1][b] + choose[a - 1][b - 1]
        }
    }
    val chooseSums = LongArray(n + 1)
    for (a in 0..n) {
        for (b in 1..k) {
            chooseSums[a] += choose[a][b]
        }
    }
    val tokenizer = StringTokenizer(jin.readLine())
    val array = IntArray(n) { tokenizer.nextToken().toInt() }
    val addends = mutableListOf<Pair<Int, Long>>()
    for (mask in 0 until (1 shl 18)) {
        if ((mask and s) == s && (mask or t) == t) {
            val groups = mutableMapOf<Int, Int>()
            for (a in array) {
                if ((a and s) == s && (a or t) == t) {
                    groups[a and mask] = (groups[a and mask] ?: 0) + 1
                }
            }
            var local = 0L
            for (amt in groups.values) {
                local += chooseSums[amt]
            }
            addends.add(Pair(Integer.bitCount(mask xor s), local))
        }
    }
    var answer = 0L
    addends.sortBy { it.first }
    for (addend in addends) {
        if (addend.first % 2 == 0) {
            answer += addend.second
        } else {
            answer -= addend.second
        }
    }
    println(answer)
}