def popcount_parity(x):

    for i in range(8):

        x ^= x >> (1 << i)

    return -1 if x & 1 else 1



N, K, S, T = list(map(int, input().split()))

if S & T != S:

    print((0))

    exit()



C = [[1]]

CC = [0] * 51

for i in range(1, 51):

    C.append([1] * (i + 1))

    for j in range(1, i):

        C[i][j] = C[i-1][j-1] + C[i-1][j]

for i in range(51):

    CC[i] = sum(C[i][1:K+1])



A = [int(a) for a in input().split()]

aa, oo = - 1, 0

for i in range(N)[::-1]:

    a = A[i]

    if a & S != S or a | T != T:

        del A[i]

        continue

    aa &= a

    oo |= a

aa ^= oo



i = aa

ans = 0

while 1:

    D = {}

    for a in A:

        t = i & a

        if t not in D: D[t] = 1

        else: D[t] += 1

    ans += sum([CC[t] for t in list(D.values())]) * popcount_parity(i)

    if not i: break

    i = (i - 1) & aa

print(ans)
def popcount_parity(x):

    x ^= x >> 1

    x ^= x >> 2

    x ^= x >> 4

    x ^= x >> 8

    x ^= x >> 16

    return -1 if x & 1 else 1



N, K, S, T = list(map(int, input().split()))

if S & T != S:

    print((0))

    exit()



C = [[1]]

CC = [0] * 51

for i in range(1, 51):

    C.append([1] * (i + 1))

    for j in range(1, i):

        C[i][j] = C[i-1][j-1] + C[i-1][j]

for i in range(51):

    CC[i] = sum(C[i][1:K+1])



A = [int(a) for a in input().split()]

aa, oo = - 1, 0

for i in range(N)[::-1]:

    a = A[i]

    if a & S != S or a | T != T:

        del A[i]

        continue

    aa &= a

    oo |= a

aa ^= oo



i = aa

ans = 0

while 1:

    D = {}

    for a in A:

        t = i & a

        if t not in D: D[t] = 1

        else: D[t] += 1

    c = 0

    for t in list(D.values()):

        c += CC[t]

    ans += c * popcount_parity(i)

    if not i: break

    i = (i - 1) & aa

print(ans)
def popcount_parity(x):
    for i in range(8):
        x ^= x >> (1 << i)
    return -1 if x & 1 else 1


N, K, S, T = list(map(int, input().split()))
if S & T != S:
    print((0))
    exit()
C = [[1]]
CC = [0] * 51
for i in range(1, 51):
    C.append([1] * (i + 1))
    for j in range(1, i):
        C[i][j] = C[i - 1][j - 1] + C[i - 1][j]
for i in range(51):
    CC[i] = sum(C[i][1 : K + 1])
A = [int(a) for a in input().split()]
aa, oo = -1, 0
for i in range(N)[::-1]:
    a = A[i]
    if a & S != S or a | T != T:
        del A[i]
        continue
    aa &= a
    oo |= a
aa ^= oo
i = aa
ans = 0
while 1:
    D = {}
    for a in A:
        t = i & a
        if t not in D:
            D[t] = 1
        else:
            D[t] += 1
    ans += sum([CC[t] for t in list(D.values())]) * popcount_parity(i)
    if not i:
        break
    i = (i - 1) & aa
print(ans)

def popcount_parity(x):
    x ^= x >> 1
    x ^= x >> 2
    x ^= x >> 4
    x ^= x >> 8
    x ^= x >> 16
    return -1 if x & 1 else 1


N, K, S, T = list(map(int, input().split()))
if S & T != S:
    print((0))
    exit()
C = [[1]]
CC = [0] * 51
for i in range(1, 51):
    C.append([1] * (i + 1))
    for j in range(1, i):
        C[i][j] = C[i - 1][j - 1] + C[i - 1][j]
for i in range(51):
    CC[i] = sum(C[i][1 : K + 1])
A = [int(a) for a in input().split()]
aa, oo = -1, 0
for i in range(N)[::-1]:
    a = A[i]
    if a & S != S or a | T != T:
        del A[i]
        continue
    aa &= a
    oo |= a
aa ^= oo
i = aa
ans = 0
while 1:
    D = {}
    for a in A:
        t = i & a
        if t not in D:
            D[t] = 1
        else:
            D[t] += 1
    c = 0
    for t in list(D.values()):
        c += CC[t]
    ans += c * popcount_parity(i)
    if not i:
        break
    i = (i - 1) & aa
print(ans)

-    for i in range(8): -        x ^= x >> (1 << i) +    x ^= x >> 1 +    x ^= x >> 2 +    x ^= x >> 4 +    x ^= x >> 8 +    x ^= x >> 16 -    ans += sum([CC[t] for t in list(D.values())]) * popcount_parity(i) +    c = 0 +    for t in list(D.values()): +        c += CC[t] +    ans += c * popcount_parity(i)