import Data.Bits

compute :: Int -> Int -> Int -> [Int] -> Int
compute k s0 t0 as = sum $ loop 1 initial
  where
    ias = zip [0..] $ filter p as
    p a = a .&. s0 == s0 && a .|. t0 == t0
    initial = [(i,a,a) | (i,a) <- ias]    
    loop _ [] = []
    loop c _ | c > k = []
    loop c ists = cnt : loop (succ c) ists'
      where
        cnt = length [() | (_,s,t) <- ists, s == s0, t == t0]
        ists' = [(j,s .&. a, t .|. a) | (i,s,t) <- ists, (j,a) <- ias, i < j]

main = do
  li <- getLine
  let [n,k,s,t] = map read $ words li
  li <- getLine
  let as = map read $ words li
  print $ compute k s t as