There are some beautiful girls in Arpa’s land as mentioned before.

Once Arpa came up with an obvious problem:

Given an array and a number x, count the number of pairs of indices i, j (1 ≤ i < j ≤ n) such that $a_{i} \oplus a_{j} = x$, where $\oplus$ is bitwise xor operation (see notes for explanation).

 [Image] 

Immediately, Mehrdad discovered a terrible solution that nobody trusted. Now Arpa needs your help to implement the solution to that problem.


-----Input-----

First line contains two integers n and x (1 ≤ n ≤ 10^5, 0 ≤ x ≤ 10^5) — the number of elements in the array and the integer x.

Second line contains n integers a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ 10^5) — the elements of the array.


-----Output-----

Print a single integer: the answer to the problem.


-----Examples-----
Input
2 3
1 2

Output
1
Input
6 1
5 1 2 3 4 1

Output
2


-----Note-----

In the first sample there is only one pair of i = 1 and j = 2. $a_{1} \oplus a_{2} = 3 = x$ so the answer is 1.

In the second sample the only two pairs are i = 3, j = 4 (since $2 \oplus 3 = 1$) and i = 1, j = 5 (since $5 \oplus 4 = 1$).

A bitwise xor takes two bit integers of equal length and performs the logical xor operation on each pair of corresponding bits. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1. You can read more about bitwise xor operation here: https://en.wikipedia.org/wiki/Bitwise_operation#XOR.

Difficulty: interview

Starter code:

Solutions:
n, x = list(map(int, input().split()))
ar = list(map(int, input().split()))

cnt = {}
ans = 0
for val in ar:
	cur = val ^ x
	
	if cur in cnt:
		ans += cnt[cur]
	
	if val in cnt:
		cnt[val] += 1
	else:
		cnt[val] = 1

print(ans)



N = 10 ** 5 + 1
n, x = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [0] * N
for a in A:
    B[a] += 1

res = 0
for i in range(N):
    if i^x < N:
        res += B[i] * B[i^x]

print((res - n) // 2 if x == 0 else res // 2)


n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
M = max(a) + 1
cnt = [0 for _ in range(M)]
for num in a:
    cnt[num] += 1
res = 0
for num in range(1, M):
    if cnt[num] > 0:
        s = num^x
        if M > s >= num:
            res += cnt[s]*cnt[num] if s != num else (cnt[s] - 1)*cnt[s]//2
print(res)


n , x = map(int,input().split())
A= list(map(int,input().split()))
d = dict()
for j in range(n):
    if A[j] in d:
        d[A[j]] += 1
    else:
        d[A[j]] = 1
ans = 0
for j in range(n):
    per = x ^ A[j]
    if A[j] != per:
        if per in d:
            ans += d[per]
    else:
        if per in d:
            ans += d[per]-1
print(ans//2)

n, x = list(map(int, input().split()))
arr = list(map(int, input().split()))
dict = {}
for v in arr:
  if v in dict:
    dict[v] += 1
  else:  
    dict[v] = 1

if x:
  res = 0
  for v in list(dict.keys()):
    if (v ^ x) in dict and (v ^ x) > v: 
      res += dict[v] * dict[v ^ x]
  print(res)  
else:
  print(sum([x*(x-1)//2 for x in list(dict.values())]))


n, x = map(int, input().split())
cnt = [0 for i in range(100010)]
arr = list(map(int, input().split()))
for num in arr:
    cnt[num] += 1
ans = 0
for num in arr:
    xor_num = x ^ num
    if xor_num > 100000:
        continue
    cnt[num] -= 1
    if cnt[xor_num] > 0:
        ans += cnt[xor_num]
print(ans)

n, x = map(int , input().split())
d = dict()
a = [int(x) for x in input().split()]
for i in a:
    if i in d:
        d[i] += 1
    else:
        d[i] = 1
k = 0
for i in a:
    c = d.get(i ^ x,  0)
    if i == i ^ x:
        k += (c - 1) / 2
    else:
        k += c / 2
print(int(k))

n, x = list(map(int, input().split()))
A = list(map(int, input().split()))
d1 = {}
for a in A:
    if a in d1:
        d1[a] += 1
    else:
        d1[a] = 1

keys = list(d1.keys())
keys.sort()
ans = 0
for k in keys:
    b = k ^ x
    if b > k:
        if b in d1:
            ans += d1[b] * d1[k]
    elif b == k:
        ans += d1[b] * (d1[b] - 1) // 2

print(ans)


temp=input().split()
n=int(temp[0])
x=int(temp[1])
temp=input().split()
a=[int(k) for k in temp]

c=[0 for i in range(10**5+1)]

for i in range(n):
	c[a[i]]+=1

ans=0
for i in range(n):
	if a[i]^x<=10**5:
		ans+=c[a[i]^x]

if x==0:
	ans-=n

ans=int(ans/2)

print(ans)

n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
d = dict()
for i in range(len(a)):
    d[a[i]] = d.get(a[i], 0) + 1
res = 0

def search(num):
    l = -1
    r = len(a) 
    while r - l > 1:
        m = (l + r) // 2
        if a[m] > k:
            r = m
        else:
            l = m
    return l


for i in range(len(a)):
    k = a[i] ^ x
    tr = search(k)
    if tr > -1 and tr < len(a) and a[tr] == k:
        res += d[a[tr]]
        if a[i] == k:
            res-= 1
    
   
        
print(res // 2)

n, x=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]

ax=[i^x for i in a]
a.sort()
ax.sort()
pos=0
posx=0
c=1
cx=1
total=0
while pos<n and posx<n:
	if a[pos]==ax[posx]:
		if pos<n-1 and a[pos+1]==a[pos]:
			pos+=1
			c+=1
		elif posx<n-1 and ax[posx+1]==ax[posx]:
			posx+=1
			cx+=1
		else:
			#print(c, cx, pos, posx)
			total+=c*cx
			c=1
			cx=1
			pos+=1
			posx+=1
	elif a[pos]>ax[posx]:
		posx+=1
	else:
		pos+=1
#print(total, a, ax)
if x>0:
	print(total//2)
else:
	print((total-n)//2)





def __starting_point():
	n, x = map(int, input().split())
	a = list(map(int, input().split()))
	freq = {}
	for v in a:
		freq[v] = freq.get(v, 0) + 1
	res = 0
	cfreq = {}
	for v in a:
		y = v ^ x
		#t = freq[v] - cfreq.get(v, 0)
		cfreq[v] = cfreq.get(v, 0) + 1
		if y in freq:
			res += freq[y]-cfreq.get(y, 0)
	print(res)
__starting_point()

n,x=list(map(int,input().split()))
ip=list(map(int,input().split()))
count=0
counts=[0 for i in range(100001)]
for i in ip:
    counts[i]+=1
for i in range(n):
    b=x^ip[i]
    counts[ip[i]]-=1
    try:
        count+=counts[b]
    except:
        b=1
print(count)


#!/usr/bin/env python3

def main():
    from collections import Counter

    try:
        while True:
            n, trg = list(map(int, input().split()))
            a = list(map(int, input().split()))
            c = Counter(a)
            result = 0
            for x in a:
                result += c[trg ^ x]
            if trg == 0:
                result -= n
            print(result >> 1)

    except EOFError:
        pass

main()


'''input
6 1
5 1 2 3 4 1
'''

def rints():
    return list(map(int, input().split()))

def ri():
    return int(input())

MAX_A = 10**5

n, x = rints()
arr = rints()

seen = [0] * (MAX_A + 1)
count = 0

for elem in arr:
    partner = x ^ elem
    if partner <= MAX_A:
        count += seen[partner]
    seen[elem] += 1

print(count)


n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
d = {}
s = set(a)
for i in a:
    d[i] = 0
for i in a:
    d[i] += 1
ans = 0
for i in s:
    if x == 0:
        ans += (d[i] * (d[i] - 1) // 2)
    else:
        ans += d[i] * d.get(i ^ x, 0)
if x == 0:
    print(ans)
else:
    print(ans // 2)


n,x=map(int,input().split())
ar=list(map(int,input().split()))
st={}
soln=0
for el in ar:
	if (el^x) in st:
		soln+=st[el^x]
	if(el in st):
		st[el]+=1
	else:
		st[el]=1
print (soln)

read = lambda: list(map(int, input().split()))
from collections import Counter
n, x = read()
a = list(read())
c = Counter()
for i in a: c[i] += 1
cnt = 0
for i in a: cnt += c[i ^ x] - (x == 0)
cnt //= 2
print(cnt)


read = lambda: list(map(int, input().split()))
from collections import Counter
n, x = read()
a = list(read())
c = Counter()
for i in a: c[i] += 1
cnt = 0
for i in a: cnt += c[i ^ x] - (x == 0)
cnt //= 2
print(cnt)


n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
if (x == 0):
    ans = 0
    s = dict()
    for elem in a:
        if elem in s:
            s[elem] += 1
        else:
            s[elem] = 1
    for key in list(s.keys()):
        ans += s[key] * (s[key] - 1)
else:
    ans = 0
    s = dict()
    for elem in a:
        if elem in s:
            s[elem] += 1
        else:
            s[elem] = 1
    for key in list(s.keys()):
        if (key^x) in s:
            ans += s[key] * s[key^x]
print(ans // 2)


_, n=map(int, input().split())
M={}
ans=0
for x in map(int, input().split()):
    ans+=M.get(x^n, 0)
    if x not in M:
        M[x]=1
    else:
        M[x]+=1
print(ans)

_, n=map(int, input().split())
M={}
ans=0
for x in map(int, input().split()):
    ans+=M.get(x^n, 0)
    M[x]=M.get(x, 0)+1
print(ans)

""" ATSTNG's ejudge Python3 solution template """
import sys, queue

try:
    import dev_act_ffc429465ab634
    DEV = True
except:
    DEV = False

def log(*s):
    if DEV: print('L',list(s),sep='')

class EJudge:
    def __init__(self, problem="default", reclim=1<<30):
        self.problem = problem
        sys.setrecursionlimit(reclim)

    def use_files(self, infile='', outfile=''):
        if infile!='':
            self.infile = open(infile)
            sys.stdin = self.infile
        if infile!='':
            self.outfile = open(outfile, 'w')
            sys.stdout = self.outfile

    def use_bacs_files(self):
        self.use_files(self.problem+'.in', self.problem+'.out')

    def get_tl(self):
        while True: pass

    def get_ml(self):
        tmp = [[[5]*100000 for _ in range(1000)]]
        while True: tmp.append([[5]*100000 for _ in range(1000)])

    def get_re(self):
        s = (0,)[8]

    def get_wa(self, wstr='blablalblah'):
        for _ in range(3): print(wstr)
        return

class IntReader:
    def __init__(self):
        self.ost = queue.Queue()

    def get(self):
        return int(self.sget())

    def sget(self):
        if self.ost.empty():
            for el in input().split():
                self.ost.put(el)
        return self.ost.get()

    def release(self):
        res = []
        while not self.ost.empty():
            res.append(self.ost.get())
        return res

###############################################################################
ej = EJudge(  )
int_reader = IntReader()
fmap = lambda f,l: list(map(f,l))
parse_int = lambda: fmap(int, input().split())
sign = lambda x: (x>0)-(x<0)

# input
n,x = parse_int()
st = [0]*100500
xored = [0]*100500
for _ in range(n): st[int_reader.get()] += 1
for idx in range(100500):
    pair = idx^x
    if pair < 100500:
        xored[pair] = st[idx]

ans = 0
for idx in range(100500):
    ans += st[idx]*xored[idx]

if x == 0: ans -= n

print(ans//2)

def main():
    n, x = list(map(int, input().split()))
    l, res = [0] * 131073, 0
    for a in map(int, input().split()):
        res += l[a ^ x]
        l[a] += 1
    print(res)


def __starting_point():
    main()

__starting_point()

n, x = list(map(int, input().split()))
a = [int(x) for x in input().split()]
ad = {}
count = 0
for i in a:
    count += ad.get(i^x, 0)
    ad[i] = ad.get(i, 0) + 1
#print(ad)
print(count)