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
  
  readline = sys.stdin.readline
  
  N, K, S, T = map(int, readline().split())
  A = list(map(int, readline().split()))
  
  # 初期状態はAND = 1111... (18桁)と OR = 0000...(18桁)
  # ここに対してAND OR を取っていくDP
  # 最後にdp[(S,T)]を数える
  # ただしS,Tともに1の桁に0が入っている数
  # S,Tともに0の桁に1が入っている数
  # は除外する
  # また、Sでは1だけどTでは0の桁があったらその時点で答えは0
  
  binS = bin(S)[2:].zfill(18)
  binT = bin(T)[2:].zfill(18)
  
  bothone = set()
  bothzero = set()
  
  for i in range(len(binS)):
      if binS[i] == "1" and binT[i] == "1":
          bothone.add(i)
      elif binS[i] == "0" and binT[i] == "0":
          bothzero.add(i)
      elif binS[i] == "1" and binT[i] == "0":
          print(0)
          exit(0)
  
  # print(bothone)
  # print(bothzero)
  
  from collections import defaultdict
  
  dp = defaultdict(int)
  dp[(2**18 - 1, 0)] = 1
  for x in A:
      newdp = defaultdict(int)
      # print("x",x)
      for da, do in dp:
          newdp[(da, do)] += dp[(da, do)]
          newand = da & x
          newor = do | x
          # print("da",da,"do",do,"newand",newand,"newor",newor)
          # newandを18桁の2進数にしたとき、bothoneの桁に0があってはいけない
          # 同時に、bothzeroの桁に1があってもいけない
          bin_newand = bin(newand)[2:].zfill(18)
          ok = True
          for i in range(len(bin_newand)):
              if i in bothone and bin_newand[i] == "0":
                  ok = False
                  break
          if not ok:
              continue
          bin_newor = bin(newor)[2:].zfill(18)
          for i in range(len(bin_newor)):
              if i in bothzero and bin_newor[i] == "1":
                  ok = False
                  break
          if ok:
              newdp[(newand, newor)] += 1
      dp = newdp
  #  print(dp)
  
  # print(dp)
  print(dp[(S, T)])
  
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"}]