output_description: Print the answer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N K S T
      A_1 A_2 ... A_N
attempt: import sys
  from collections import deque
  
  
  def LI():
      return list(map(int, sys.stdin.readline().rstrip().split()))
  
  
  def solve(n, k, s, t, a):
      count = 0
      na = deque()
      for i in range(n):
          print(s & 1, a[i] & 1)
          A = a[i]
          if A <= t:
              if s & 1:
                  if s & 1 == A & 1:
                      na.append(A)
              else:
                  na.append(A)
      a = na
      n = len(a)
      for bit in range(2**n):
          tmp = bin(bit).count("1")
          if tmp <= k:
              ss = tt = -1
              stp = 0
              for i in range(n):
                  if (bit >> i) & 1:
                      if ss == -1 or tt == -1:
                          ss = a[i]
                          tt = a[i]
                          stp += 1
                      else:
                          ss &= a[i]
                          tt |= a[i]
                          stp += 1
                  if stp == tmp:
                      break
              if ss == s and tt == t:
                  count += 1
      return count
  
  
  def main():
      tmp = deque(LI())
      n, k, s, t = tmp.popleft(), tmp.popleft(), tmp.popleft(), tmp.popleft()
      a = deque(LI())
      print(solve(n, k, s, t, a))
      return
  
  
  if __name__ == "__main__":
      main()
  
problem_description: Statement
  
  Given are N pairwise distinct non-negative integers A_1,A_2,\ldots,A_N. Find
  the number of ways to choose a set of between 1 and K numbers (inclusive) from
  the given numbers so that the following two conditions are satisfied:
  
    * The bitwise AND of the chosen numbers is S.
    * The bitwise OR of the chosen numbers is T.
samples: [{"input": "3 3 0 3\n    1 2 3", "output": "2\n    \n\nThe conditions are satisfied when we choose \\\\{1,2\\\\} or \\\\{1,2,3\\\\}.\n\n* * *"}, {"input": "5 3 1 7\n    3 4 9 1 5", "output": "2\n    \n\n* * *"}, {"input": "5 4 0 15\n    3 4 9 1 5", "output": "3"}]