Sasha likes programming. Once, during a very long contest, Sasha decided that he was a bit tired and needed to relax. So he did. But since Sasha isn't an ordinary guy, he prefers to relax unusually. During leisure time Sasha likes to upsolve unsolved problems because upsolving is very useful.

Therefore, Sasha decided to upsolve the following problem:

You have an array $a$ with $n$ integers. You need to count the number of funny pairs $(l, r)$ $(l \leq r)$. To check if a pair $(l, r)$ is a funny pair, take $mid = \frac{l + r - 1}{2}$, then if $r - l + 1$ is an even number and $a_l \oplus a_{l+1} \oplus \ldots \oplus a_{mid} = a_{mid + 1} \oplus a_{mid + 2} \oplus \ldots \oplus a_r$, then the pair is funny. In other words, $\oplus$ of elements of the left half of the subarray from $l$ to $r$ should be equal to $\oplus$ of elements of the right half. Note that $\oplus$ denotes the bitwise XOR operation.

It is time to continue solving the contest, so Sasha asked you to solve this task.


-----Input-----

The first line contains one integer $n$ ($2 \le n \le 3 \cdot 10^5$) — the size of the array.

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($0 \le a_i < 2^{20}$) — array itself.


-----Output-----

Print one integer — the number of funny pairs. You should consider only pairs where $r - l + 1$ is even number.


-----Examples-----
Input
5
1 2 3 4 5

Output
1

Input
6
3 2 2 3 7 6

Output
3

Input
3
42 4 2

Output
0



-----Note-----

Be as cool as Sasha, upsolve problems!

In the first example, the only funny pair is $(2, 5)$, as $2 \oplus 3 = 4 \oplus 5 = 1$.

In the second example, funny pairs are $(2, 3)$, $(1, 4)$, and $(3, 6)$.

In the third example, there are no funny pairs.

Difficulty: MEDIUM_HARD

Solutions:
def main():
	n = int(input())
	a = map(int, input().split())
	cnt = [{} for _ in range(2)]
	xor = 0
	result = 0
	cnt[1][0] = 1
	for (i, x) in enumerate(a):
		xor ^= x
		index = i & 1
		result += int(cnt[index].get(xor) or 0)
		cnt[index][xor] = int(cnt[index].get(xor) or 0) + 1
	print(result)
main()


import sys
import math
from collections import defaultdict
dp = defaultdict(list)
dp[0] = [1, 0]
n = int(sys.stdin.readline())
arr = list(map(int, sys.stdin.readline().split()))
x = 0
ans = 0
for i in range(1, n + 1):
	x = x ^ arr[i - 1]
	if dp[x] == []:
		dp[x] = [0, 0]
		if i % 2 == 0:
			dp[x][0] += 1
		else:
			dp[x][1] += 1
	elif i % 2 == 0:
		ans += dp[x][0]
		dp[x][0] += 1
	else:
		ans += dp[x][1]
		dp[x][1] += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
ans = 0
o = {}
e = {}
x = [a[0]]
for i in range(1, n):
	g = a[i] ^ x[-1]
	x.append(g)
	if g == 0 and i % 2 == 1:
		ans = ans + 1
s = [0] * n
for i in range(n):
	if i % 2 == 1:
		u = o.get(x[i], -1)
		if u == -1:
			o[x[i]] = i
		else:
			s[i] = s[u] + 1
			o[x[i]] = i
	else:
		u = e.get(x[i], -1)
		if u == -1:
			e[x[i]] = i
		else:
			s[i] = s[u] + 1
			e[x[i]] = i
ans = ans + sum(s)
print(ans)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	cnt = [[0] * (1 << 21) for _ in range(2)]
	cnt[1][0] = 1
	(curr, ret) = (0, 0)
	for (i, x) in enumerate(a):
		curr ^= x
		ret += cnt[i % 2][curr]
		cnt[i % 2][curr] += 1
	print(ret)
main()


n = int(input())
pref = [0]
app = pref.append
for (i, x) in enumerate(map(int, input().split())):
	app(pref[-1] ^ x)
from collections import Counter
d = Counter(pref[::2])
di = Counter(pref[1::2])
res = 0
for (i, x) in enumerate(d.values()):
	res += x * (x - 1) // 2
for (i, x) in enumerate(di.values()):
	res += x * (x - 1) // 2
print(res)


n = int(input())
n_integers = [int(x) for x in input().split()]
n_integers_cumulative = [0] * len(n_integers)
n_even = 0
n_odd = 0
if n % 2 == 0:
	n_even = int(n / 2) + 1
	n_odd = n + 1 - n_even
else:
	n_even = int((n + 1) / 2)
	n_odd = n + 1 - n_even
even_integers_cumulative = []
odd_integers_cumulative = []
even_counts = {}
odd_counts = {}
for x in range(0, n):
	n_integers_cumulative[x] = n_integers_cumulative[x - 1] ^ n_integers[x]
	if x % 2 == 0:
		even_integers_cumulative.append(n_integers_cumulative[x])
		if n_integers_cumulative[x] in even_counts:
			even_counts[n_integers_cumulative[x]] = even_counts[n_integers_cumulative[x]] + 1
		else:
			even_counts[n_integers_cumulative[x]] = 1
	else:
		odd_integers_cumulative.append(n_integers_cumulative[x])
		if n_integers_cumulative[x] in odd_counts:
			odd_counts[n_integers_cumulative[x]] = odd_counts[n_integers_cumulative[x]] + 1
		else:
			odd_counts[n_integers_cumulative[x]] = 1
counter = 0
for x in odd_counts:
	counter = counter + int(odd_counts[x] * (odd_counts[x] - 1) / 2)
for x in even_counts:
	counter = counter + int(even_counts[x] * (even_counts[x] - 1) / 2)
if 0 in odd_counts:
	counter = counter + odd_counts[0]
print(counter)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
a = list(map(int, input().split()))
pre = [0]
for i in a:
	pre.append(pre[-1] ^ i)
odd = dict()
even = dict()
for i in range(len(pre)):
	if i % 2 == 0:
		if pre[i] in even:
			even[pre[i]] += 1
		else:
			even[pre[i]] = 1
	elif pre[i] in odd:
		odd[pre[i]] += 1
	else:
		odd[pre[i]] = 1
r = 0
for i in odd:
	r += (odd[i] - 1) * odd[i] // 2
for i in even:
	r += (even[i] - 1) * even[i] // 2
print(r)


n = int(input())
arr = list(map(int, input().split()))
pre = [0] * (n + 1)
for i in range(n):
	pre[i + 1] = pre[i] ^ arr[i]
d = {}
d1 = {}
for i in range(n + 1):
	if i % 2 == 0:
		if pre[i] in d:
			d[pre[i]] += 1
		else:
			d[pre[i]] = 1
	elif pre[i] in d1:
		d1[pre[i]] += 1
	else:
		d1[pre[i]] = 1
ans = 0
for (key, value) in d.items():
	ans += value * (value - 1) // 2
for (key, value) in d1.items():
	ans += value * (value - 1) // 2
print(ans)


n = int(input())
a = list(map(int, input().split()))
prev = [0]
for i in range(n):
	prev.append(a[i] ^ prev[-1])
var = {}
var1 = {}
a = prev[::2]
b = prev[1::2]
ans = 0
for c in a:
	var[c] = var.get(c, 0) + 1
for x in b:
	var1[x] = var1.get(x, 0) + 1
for c in var:
	ans += var[c] * (var[c] - 1) // 2
for c in var1:
	ans += var1[c] * (var1[c] - 1) // 2
print(ans)


from collections import Counter
n = int(input())
x = [0]
for v in map(int, input().split()):
	x.append(x[-1] ^ v)
c0 = Counter(x[::2])
c1 = Counter(x[1::2])
r = 0
for v in c0.values():
	r += v * (v - 1) // 2
for v in c1.values():
	r += v * (v - 1) // 2
print(r)


(n, d, curr) = (int(input()), {(0, 1): 1}, 0)
for (i, e) in enumerate(map(int, input().split())):
	curr ^= e
	p = (curr, i & 1)
	d[p] = d.get(p, 0) + 1
res = sum((n * (n - 1) // 2 for n in list(d.values())))
print(res)


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
cnt = [[0] * (1 << 21) for i in range(2)]
cnt[1][0] = 1
x = 0
ans = 0
for i in range(n):
	x ^= a[i]
	ans += cnt[i % 2][x]
	cnt[i % 2][x] += 1
print(ans)


n = int(input())
arr = list(map(int, input().strip().split()))
dp = [0 for i in range(n)]
for i in range(n):
	dp[i] = dp[i - 1] ^ arr[i]
dp.insert(0, 0)
tot = 0
dicti = {}
for i in range(n + 1):
	if dp[i] not in dicti:
		dicti[dp[i]] = [1, 0] if i % 2 == 0 else [0, 1]
	elif i % 2 == 0:
		tot += dicti[dp[i]][0]
		dicti[dp[i]][0] += 1
	else:
		tot += dicti[dp[i]][1]
		dicti[dp[i]][1] += 1
print(tot)


answer = 0
x = 0
g = {0: {}, 1: {}}
g[1][0] = 1

def solve(v, index):
	global x
	x ^= int(v)
	ans = g[index % 2].get(x, 0)
	g[index % 2][x] = g[index % 2].get(x, 0) + 1
	return ans
n = int(input())
a = list(map(int, input().split()))
for i in range(len(a)):
	answer += solve(a[i], i)
print(answer)


from collections import Counter

def solve(n, a):
	f = [(0, 0)] * n
	for i in range(n):
		f[i] = ((f[i - 1][0] if i > 0 else 0) ^ a[i], i % 2)
	res = 0
	c = Counter(f)
	c[0, 1] += 1
	for v in c.values():
		res += v * (v - 1) // 2
	return res
n = int(input())
a = list(map(int, input().split()))
print(solve(n, a))


from collections import Counter

def read_nums():
	return [int(x) for x in input().split()]

def solve_quick(n, nums):
	xor_nums = [nums[0]]
	for i in range(1, n):
		xor_nums.append(nums[i] ^ xor_nums[-1])
	res = 0
	c_odd = Counter([0])
	c_even = Counter()
	c = {0: c_even, 1: c_odd}
	for i in range(n):
		cur_xor = xor_nums[i]
		res += c[i % 2][cur_xor]
		c[i % 2][cur_xor] += 1
	return res

def solve_slow(n, nums):
	res = 0
	for w_size in range(2, n + 1, 2):
		for i in range(n - w_size + 1):
			xor = 0
			for j in range(i, i + w_size):
				xor ^= nums[j]
			if xor == 0:
				res += 1
	return res

def main():
	(n,) = read_nums()
	nums = read_nums()
	print(solve_quick(n, nums))
main()


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from collections import defaultdict as dd
(n,) = I()
l = I()
a = [0] + l[:]
for i in range(n):
	a[i + 1] ^= a[i]
b = dd(list)
for i in range(n + 1):
	b[a[i]].append(i)
ans = 0
for i in b:
	k = b[i]
	o = 0
	e = 0
	for j in k:
		if j % 2:
			o += 1
		else:
			e += 1
	ans += o * (o - 1) // 2 + e * (e - 1) // 2
print(ans)


n = int(input())
a = list(map(int, input().split()))
p = [a[0]]
for i in range(1, n):
	p.append(a[i] ^ p[i - 1])
c = [{0: 1}, {}]
for i in range(n):
	if i % 2:
		if p[i] in c[0]:
			c[0][p[i]] += 1
		else:
			c[0][p[i]] = 1
	elif p[i] in c[1]:
		c[1][p[i]] += 1
	else:
		c[1][p[i]] = 1
ans = 0
for i in range(2):
	for j in c[i]:
		if c[i][j] >= 2:
			ans += c[i][j] * (c[i][j] - 1) // 2
print(ans)


n = int(input())
a = input().split()
for i in range(n):
	a[i] = int(a[i])
if n == 2:
	if a[0] ^ a[1] == 0:
		print(1)
	else:
		print(0)
else:
	even = [0 for x in range(n // 2)]
	odd = [0 for x in range((n - 1) // 2)]
	even[0] = a[0] ^ a[1]
	odd[0] = a[1] ^ a[2]
	for i in range(1, n // 2):
		even[i] = even[i - 1] ^ a[2 * i] ^ a[2 * i + 1]
	for i in range(1, (n - 1) // 2):
		odd[i] = odd[i - 1] ^ a[2 * i + 1] ^ a[2 * i + 2]
	evendict = {}
	odddict = {}
	for i in even:
		evendict[i] = evendict.get(i, 0) + 1
	for i in odd:
		odddict[i] = odddict.get(i, 0) + 1
	counter = evendict.get(0, 0) + odddict.get(0, 0)
	for keys in evendict:
		counter = evendict[keys] * (evendict[keys] - 1) // 2 + counter
	for keys in odddict:
		counter = odddict[keys] * (odddict[keys] - 1) // 2 + counter
	print(counter)


n = int(input())
a = [int(x) for x in input().split()]
pref = [0]
for i in range(n):
	pref.append(pref[-1] ^ a[i])
dp = [[0 for i in range(2 ** 20 + 5)] for j in range(2)]
ans = 0
for i in range(len(pref)):
	ans += dp[i % 2][pref[i]]
	dp[i % 2][pref[i]] += 1
print(ans)


from collections import defaultdict
n = int(input())
l = list(map(int, input().split()))
odddp = defaultdict(int)
evendp = defaultdict(int)
xor = 0
count = 0
odddp[0] = 1
for i in range(n):
	xor = xor ^ l[i]
	if i % 2 == 0:
		count += evendp[xor]
		evendp[xor] += 1
	else:
		count += odddp[xor]
		odddp[xor] += 1
print(count)


import sys, os, io
from math import log, gcd, ceil
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from sys import stdin
import math

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def si():
	return input()

def prefix_sum(arr):
	r = [0] * (len(arr) + 1)
	for (i, el) in enumerate(arr):
		r[i + 1] = r[i] + el
	return r

def divideCeil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def ii():
	return int(input())

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

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
t = 1
for _ in range(t):
	n = ii()
	l = li()
	dice = defaultdict(lambda : 0)
	dico = defaultdict(lambda : 0)
	cur = 0
	ans = 0
	ind = 0
	dico[0] += 1
	for i in l:
		cur ^= i
		if ind % 2 == 0:
			ans += dice[cur]
			dice[cur] += 1
		else:
			ans += dico[cur]
			dico[cur] += 1
		ind += 1
	print(ans)


n = int(input())
c = [{}, {0: 1}]
s = 0
ans = 0
for (i, x) in enumerate(map(int, input().split())):
	j = i % 2
	s ^= x
	ans += c[j].get(s, 0)
	c[j][s] = c[j].get(s, 0) + 1
print(ans)


import sys
input = sys.stdin.readline
from math import *
n = int(input())
a = [int(x) for x in input().split()]
d = {}
s = 0
c = 0
d[0] = [0, 1]
for i in range(n):
	s ^= a[i]
	if s in d:
		c += d[s][i % 2]
		if i % 2 == 0:
			d[s][0] += 1
		else:
			d[s][1] += 1
	elif i & 1:
		d[s] = [0, 1]
	else:
		d[s] = [1, 0]
print(c)


n = int(input())
a = list(map(int, input().split()))
o = {}
e = {}
t = a[0]
e[t] = 1
o[0] = 1
(ans, i) = (0, 1)
odd = True
while i < n:
	t ^= a[i]
	if odd:
		ans += o.get(t, 0)
		o[t] = o.get(t, 0) + 1
	else:
		ans += e.get(t, 0)
		e[t] = e.get(t, 0) + 1
	i += 1
	odd = 1 - odd
print(ans)


from itertools import accumulate
from collections import Counter
import operator
n = int(input())
alist = list(map(int, input().split()))
acc = list(accumulate(alist, operator.xor))
acc1 = acc[::2]
acc2 = acc[1::2]
c1 = Counter(acc1)
c2 = Counter(acc2)
c2[0] += 1
ans = 0
for i in set(c1):
	c = c1[i]
	ans += c * (c - 1) // 2
for i in set(c2):
	c = c2[i]
	ans += c * (c - 1) // 2
print(ans)


n = int(input())
arr = [int(x) for x in input().split()]
pref = [0]
for i in range(len(arr)):
	pref.append(pref[-1] ^ arr[i])
a = pref[::2]
b = pref[1::2]
d1 = {}
d2 = {}
for i in a:
	d1[i] = d1.get(i, 0) + 1
for i in b:
	d2[i] = d2.get(i, 0) + 1
res = sum([n * (n - 1) // 2 for n in d1.values()])
res += sum([n * (n - 1) // 2 for n in d2.values()])
print(res)


import collections
n = int(input())
arr = list(map(int, input().split()))
bx = [arr[0]]
for i in range(1, n):
	bx.append(bx[i - 1] ^ arr[i])
ans = 0
dic = collections.defaultdict(list)
dic1 = collections.defaultdict(list)
dic1[0] = [-1]
for i in range(0, n, 2):
	ans += len(dic[bx[i]])
	dic[bx[i]].append(i)
for i in range(1, n, 2):
	ans += len(dic1[bx[i]])
	dic1[bx[i]].append(i)
print(ans)


n = int(input())
a = [0] + list(map(int, input().split()))
dict_even = {}
dict_odd = {}
count = 0
xor = 0
for i in range(0, n + 1):
	xor = xor ^ a[i]
	if i % 2 == 0:
		if xor in dict_even:
			count += dict_even[xor]
			dict_even[xor] += 1
		else:
			dict_even[xor] = 1
	elif xor in dict_odd:
		count += dict_odd[xor]
		dict_odd[xor] += 1
	else:
		dict_odd[xor] = 1
print(count)


def main():
	n = int(input())
	arr = list(map(int, input().split()))
	dp = [0] * (n + 1)
	xors = {}
	xors[0] = [0]
	for i in range(1, n + 1):
		dp[i] = dp[i - 1] ^ arr[i - 1]
		if dp[i] not in xors.keys():
			xors[dp[i]] = []
		xors[dp[i]].append(i)
	ans = 0
	for x in xors.keys():
		indices = xors[x][:]
		indices.reverse()
		dp = [[0, 0]]
		for i in indices:
			counts = dp[-1][:]
			if i % 2 == 0:
				counts[0] += 1
			else:
				counts[1] += 1
			dp.append(counts)
		indices.reverse()
		dp.pop(0)
		dp.reverse()
		for i in range(len(indices) - 1):
			if indices[i] % 2 == 0:
				ans += dp[i + 1][0]
			else:
				ans += dp[i + 1][1]
	print(ans)
main()


n = int(input())
g = [int(g) for g in input().split()]
xor = 0
arr = [[0] * 2 ** 20, [1] + [0] * (2 ** 20 - 1)]
count = 0
for i in range(len(g)):
	xor ^= g[i]
	count += arr[i % 2][xor]
	arr[i % 2][xor] += 1
print(count)


n = int(input())
l = list(map(int, input().strip().split()))
even = [0 for i in range(2 ** 21)]
odd = [0 for i in range(2 ** 21)]
cur = 0
even[0] = 1
for i in range(n):
	cur = cur ^ l[i]
	if i % 2:
		even[cur] += 1
	else:
		odd[cur] += 1
ans = 0
for i in range(2 ** 21):
	if even[i] >= 2:
		ans += even[i] * (even[i] - 1) / 2
	if odd[i] >= 2:
		ans += odd[i] * (odd[i] - 1) / 2
print(int(ans))


import sys
from functools import reduce
from math import sqrt, floor

def eprint(*args, **kwargs):
	if not __debug__:
		print(*args, file=sys.stderr, **kwargs)
eprint('Local\n')
for t in range(int(input()) if not __debug__ else 1):
	n = int(input())
	arr = list(map(int, input().split()))
	amax = (1 << 20) + 1
	c_xor_freq = [[0 for i in range(amax)] for j in range(2)]
	c_xor_freq[1][0] = 1
	xor = 0
	res = 0
	for i in range(n):
		xor ^= arr[i]
		res += c_xor_freq[i % 2][xor]
		c_xor_freq[i % 2][xor] += 1
	print(res)


import sys
input = sys.stdin.readline
n = int(input())
lis = list(map(int, input().split()))
xor = [0] * (n + 1)
for i in range(1, n + 1):
	xor[i] = xor[i - 1] ^ lis[i - 1]
cnt = [[0] * (max(xor) + 1) for i in range(2)]
ans = 0
for i in range(n + 1):
	ans += cnt[i & 1][xor[i]]
	cnt[i & 1][xor[i]] += 1
print(ans)


import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict, deque, Counter, OrderedDict
from copy import deepcopy
import threading

def main():
	n = int(input())
	a = [*map(int, input().split())]
	ans = 0
	x = 0
	D = [[0] * 2 for _ in range(2 ** 20)]
	D[0][1] = 1
	for i in range(n):
		x ^= a[i]
		ans += D[x][i % 2]
		D[x][i % 2] += 1
	print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
input = lambda : sys.stdin.readline().rstrip()
n = int(input())
arr = list(map(int, input().split()))
odd_dict = {}
even_dict = {}
(pref_xor, answer) = (0, 0)
odd_dict[0] = 1
for id in range(n):
	pref_xor ^= arr[id]
	if id % 2:
		answer += odd_dict.get(pref_xor, 0)
		odd_dict[pref_xor] = 1 if not pref_xor in odd_dict else odd_dict[pref_xor] + 1
	else:
		answer += even_dict.get(pref_xor, 0)
		even_dict[pref_xor] = 1 if not pref_xor in even_dict else even_dict[pref_xor] + 1
print(answer)


n = int(input())
a = list(map(int, input().split()))
cnt = [[0] * pow(2, 20) for i in range(2)]
res = 0
x = 0
for i in range(len(a)):
	x ^= a[i]
	res += cnt[i & 1][x]
	cnt[i & 1][x] += 1
print(res + cnt[1][0])


from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
pf = [0]
for i in range(n):
	pf.append(pf[-1] ^ a[i])
odd = defaultdict(int)
even = defaultdict(int)
for i in range(1 + n):
	if i % 2:
		odd[pf[i]] += 1
	else:
		even[pf[i]] += 1
ct = 0
for (k, v) in odd.items():
	ct += v * (v - 1) // 2
for (k, v) in even.items():
	ct += v * (v - 1) // 2
print(ct)


import os
import sys
from io import BytesIO, IOBase
from collections import Counter

def main():
	input()
	a = list(map(int, input().split()))
	(b, x, ans) = (Counter(), 0, 0)
	b[0] = [1, 0]
	for (i, v) in enumerate(a):
		x ^= v
		z = b[x]
		if z:
			if i % 2:
				ans += z[0]
			else:
				ans += z[1]
		else:
			z = [0, 0]
		if i % 2:
			b[x] = [z[0] + 1, z[1]]
		else:
			b[x] = [z[0], z[1] + 1]
	print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
a = list(map(int, input().split()))
ans = [[0] * (2 ** 20 + 5) for i in range(2)]
ans[1][0] = 1
(x, an) = (0, 0)
for i in range(n):
	x ^= a[i]
	an += ans[i % 2][x]
	ans[i % 2][x] += 1
print(an)


from collections import defaultdict
d = defaultdict(list)
n = int(input())
list1 = list(map(int, input().split()))
ans = 0
s = 0
d[s] = [1, 0]
for i in range(n):
	s = s ^ list1[i]
	if (i + 1) % 2 == 0:
		p = d[s]
		if len(p) == 0:
			d[s] = [1, 0]
		else:
			ans += d[s][0]
			d[s][0] += 1
	else:
		p = d[s]
		if len(p) == 0:
			d[s] = [0, 1]
		else:
			ans += d[s][1]
			d[s][1] += 1
print(ans)


n = int(input())
nlist = [int(x) for x in input().split()]
xor = [[0] * 2 ** 21 for xor in range(2)]
x = counter = 0
xor[1][0] = 1
for i in range(n):
	x ^= nlist[i]
	counter += xor[i % 2][x]
	xor[i % 2][x] += 1
print(counter)


n = int(input())
a = list(map(int, input().split()))
dp = [[0 for _ in range(1 << 20)] for _ in range(2)]
dp[1][0] = 1
xor = 0
ret = 0
for i in range(n):
	xor ^= a[i]
	ret += dp[i & 1][xor]
	dp[i & 1][xor] += 1
print(ret)


from math import *
from collections import *
import sys
sys.setrecursionlimit(10 ** 9)
n = int(input())
a = list(map(int, input().split()))
pre = [0]
for i in range(n):
	pre.append(pre[-1] ^ a[i])
de = dict()
do = dict()
for i in range(n + 1):
	if i % 2 == 0:
		if pre[i] not in de:
			de[pre[i]] = 1
		else:
			de[pre[i]] += 1
	elif pre[i] not in do:
		do[pre[i]] = 1
	else:
		do[pre[i]] += 1
ans = 0
for x in list(de.values()):
	ans += x * (x - 1) // 2
for x in list(do.values()):
	ans += x * (x - 1) // 2
print(ans)


input()
d = {(0, 0): 1}
s = i = 0
for x in map(int, input().split()):
	s ^= x
	i ^= 1
	d[s, i] = d.get((s, i), 0) + 1
print(sum((d[x] * (d[x] - 1) // 2 for x in d)))


import os
import sys
from io import BytesIO, IOBase
import math
from queue import Queue
import itertools
import bisect
import heapq

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def lis(arr):
	n = len(arr)
	lis = [1] * n
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
	maximum = 0
	for i in range(n):
		maximum = max(maximum, lis[i])
	return maximum

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def maxfac(n):
	root = int(n ** 0.5)
	for i in range(2, root + 1):
		if n % i == 0:
			return n // i
	return n

def p2(n):
	c = 0
	while n % 2 == 0:
		n //= 2
		c += 1
	return c

def seive(n):
	primes = [True] * (n + 1)
	primes[1] = primes[0] = False
	for i in range(2, n + 1):
		if primes[i]:
			for j in range(i + i, n + 1, i):
				primes[j] = False
	p = []
	for i in range(0, n + 1):
		if primes[i]:
			p.append(i)
	return p

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def denofactinverse(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return pow(fac, m - 2, m)

def numofact(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return fac

def sod(n):
	s = 0
	while n > 0:
		s += n % 10
		n //= 10
	return s
n = int(input())
l = list(map(int, input().split()))
pre = [[0] * (2 ** 20 + 2) for i in range(0, 2)]
cxr = 0
ans = 0
pre[1][0] = 1
for i in range(0, n):
	cxr ^= l[i]
	ans += pre[i % 2][cxr]
	pre[i % 2][cxr] += 1
print(ans)


import sys
input = sys.stdin.readline
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
d_even = defaultdict(int)
d_odd = defaultdict(int)
acc_xor = 0
d_odd[0] += 1
ans = 0
for i in range(n):
	acc_xor ^= a[i]
	if i % 2 == 0:
		ans += d_even[acc_xor]
		d_even[acc_xor] += 1
	else:
		ans += d_odd[acc_xor]
		d_odd[acc_xor] += 1
print(ans)


import math
import sys
from bisect import bisect_right, bisect_left, insort_right
from collections import Counter, defaultdict
from heapq import heappop, heappush
from itertools import accumulate, permutations, combinations
from sys import stdout
R = lambda : map(int, input().split())
n = int(input())
dp = defaultdict(lambda : [0, 0])
dp[0] = [1, 0]
xor = res = 0
for (i, x) in enumerate(R()):
	xor ^= x
	res += dp[xor][i + 1 & 1]
	dp[xor][i + 1 & 1] += 1
print(res)


n = int(input())
a = list(map(int, input().split()))
b = [0] * 2 ** 20
c = [0] * 2 ** 20
b[0] += 1
s = 0
ans = 0
for i in range(n):
	s ^= a[i]
	if i % 2 == 0:
		ans += c[s]
		c[s] += 1
	else:
		ans += b[s]
		b[s] += 1
print(ans)


import sys
input = sys.stdin.buffer.readline
n = int(input())
a = list(map(int, input().split()))
odd = dict()
eve = dict()
tmp = 0
odd[tmp] = 1
res = 0
for i in range(n):
	tmp = tmp ^ a[i]
	if i % 2 == 0:
		if tmp in eve:
			res += eve[tmp]
			eve[tmp] += 1
		else:
			eve[tmp] = 1
	elif tmp in odd:
		res += odd[tmp]
		odd[tmp] += 1
	else:
		odd[tmp] = 1
print(res)


n = int(input())
a = [int(x) for x in input().split()]
pred = [0]
for i in range(n):
	pred.append(a[i] ^ pred[-1])
d = {}
d1 = {}
a = pred[::2]
b = pred[1::2]
ans = 0
for i in a:
	d[i] = d.get(i, 0) + 1
for i in b:
	d1[i] = d1.get(i, 0) + 1
for i in d:
	ans += d[i] * (d[i] - 1) // 2
for i in d1:
	ans += d1[i] * (d1[i] - 1) // 2
print(ans)


n = int(input())
a = [int(t) for t in input().split(' ')]
p = [0 for _ in range(n + 1)]
for i in range(1, n + 1):
	p[i] = p[i - 1] ^ a[i - 1]
counts = [{}, {}]
for t in range(2):
	for l in range(t, n + 1, 2):
		counts[t][p[l]] = counts[t].get(p[l], 0) + 1
count = 0
for t in range(2):
	cur_dict = counts[t]
	for v in cur_dict.values():
		count += v * (v - 1) // 2
print(count)


n = int(input())
entr = input().split()
entr = [int(x) for x in entr]
count = []
lista = {}
lista2 = {}
count.append(lista)
count.append(lista2)
count[1][0] = 1
resp = 0
soma = 0
for i in range(n):
	soma ^= entr[i]
	if soma in count[i % 2]:
		resp += count[i % 2][soma]
		count[i % 2][soma] += 1
	else:
		count[i % 2][soma] = 1
print(resp)


import sys
from collections import defaultdict
input = sys.stdin.readline
n = int(input())
arr = list(map(int, input().strip().split()))
xr = 0
ev = defaultdict(int)
od = defaultdict(int)
od[0] += 1
ans = 0
for i in range(n):
	xr ^= arr[i]
	if i & 1:
		ans += od[xr]
		od[xr] += 1
	else:
		ans += ev[xr]
		ev[xr] += 1
print(ans)


import os, sys, math
from io import BytesIO, IOBase
from collections import defaultdict, deque, OrderedDict
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')

def I():
	return int(input())

def In():
	return map(int, input().split())

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

def Sn():
	return input().strip()
BUFSIZE = 8192

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return len(a)

def solve():
	n = I()
	l = list(In())
	(ans, x) = (0, 0)
	dp = [{}, {}]
	dp[1][0] = 1
	for i in range(n):
		x ^= l[i]
		ans += dp[i % 2].get(x, 0)
		if dp[i % 2].get(x, -1) != -1:
			dp[i % 2][x] += 1
		else:
			dp[i % 2][x] = 1
	print(ans)
	pass

def main():
	T = 1
	for i in range(T):
		solve()
M = 998244353
P = 1000000007

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from collections import Counter
n = int(input())
a = [int(X) for X in input().split()]
p = [0]
for i in range(n):
	p.append(p[-1] ^ a[i])
x = Counter(p[::2])
y = Counter(p[1::2])
an = 0
for i in x:
	an += x[i] * (x[i] - 1) // 2
for j in y:
	an += y[j] * (y[j] - 1) // 2
print(an)


import sys
import math

def getAndParseInt(num=1):
	string = sys.stdin.readline().strip()
	if num == 1:
		return int(string)
	else:
		return [int(part) for part in string.split()]

def getAndParseString(num=1, delim=' '):
	string = sys.stdin.readline().strip()
	if num == 1:
		return string
	else:
		return [part for part in string.split(delim)]
n = getAndParseInt()
nums = getAndParseInt(2)
xors = [{}, {0: 1}]
total = 0
running_xor = 0
for (index, num) in enumerate(nums):
	running_xor = running_xor ^ num
	total += xors[index % 2].get(running_xor, 0)
	xors[index % 2][running_xor] = xors[index % 2].get(running_xor, 0) + 1
print(total)


n = int(input())
arr = list(map(int, input().split()))
odd_dict = {}
even_dict = {}
(pref_xor, answer) = (0, 0)
odd_dict[0] = 1
for id in range(n):
	pref_xor ^= arr[id]
	if id % 2:
		answer += odd_dict.get(pref_xor, 0)
		odd_dict[pref_xor] = 1 if not pref_xor in odd_dict else odd_dict[pref_xor] + 1
	else:
		answer += even_dict.get(pref_xor, 0)
		even_dict[pref_xor] = 1 if not pref_xor in even_dict else even_dict[pref_xor] + 1
print(answer)


from collections import defaultdict
hash = defaultdict(list)
n = int(input())
l = list(map(int, input().split()))
ba = 0
c = [0]
for i in range(n):
	c.append(c[-1] ^ l[i])
dp = [[0 for i in range(2 ** 20 + 5)] for j in range(2)]
ans = 0
for i in range(n + 1):
	ans += dp[i % 2][c[i]]
	dp[i % 2][c[i]] += 1
print(ans)


from collections import Counter

def check_funny(n, nums):
	cnt = {0: Counter(), 1: Counter()}
	cnt[1][0] = 1
	x = 0
	res = 0
	for i in range(n):
		x ^= nums[i]
		res += cnt[i % 2][x]
		cnt[i % 2][x] += 1
	return res
n = int(input())
nums = list(map(int, input().split()))
print(check_funny(n, nums))


n = int(input())
a = [int(x) for x in input().split()]
cnt = [[0, 0] for x in range((1 << 20) + 3)]
cnt[0][1] = 1
x = 0
res = 0
for j in range(n):
	x ^= a[j]
	res += cnt[x][j % 2]
	cnt[x][j % 2] += 1
print(res)


n = int(input())
a = list(map(int, input().split()))
d0 = {}
d1 = {}
cx = 0
ans = 0
for i in range(n):
	cx = cx ^ a[i]
	if cx == 0 and i % 2 == 1:
		ans += 1
	if i % 2 == 1:
		ans += d1.get(cx, 0)
		if cx not in d1:
			d1[cx] = 0
		d1[cx] += 1
	else:
		ans += d0.get(cx, 0)
		if cx not in d0:
			d0[cx] = 0
		d0[cx] += 1
print(ans)


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

class SegmentTree(object):

	def __init__(self, nums):
		self.n = len(nums)
		self.tree = [0] * (2 * self.n)

		def buildTree(nums):
			self.tree[self.n:] = nums[:]
			for i in range(self.n - 1, 0, -1):
				self.tree[i] = self.tree[2 * i] ^ self.tree[2 * i + 1]
		buildTree(nums)

	def update(self, i, val):
		i += self.n
		self.tree[i] = val
		while i > 0:
			self.tree[i // 2] = self.tree[i // 2 * 2] + self.tree[i // 2 * 2 + 1]
			i //= 2

	def sumRange(self, i, j):
		(i, j) = (i + self.n, j + self.n)
		sums = 0
		while i <= j:
			if i % 2 == 1:
				sums ^= self.tree[i]
				i += 1
			if j % 2 == 0:
				sums ^= self.tree[j]
				j -= 1
			i //= 2
			j //= 2
		return sums
res = 0
now = 0
os = [0] * (1 << 20)
os[0] = 1
js = [0] * (1 << 20)
for i in range(1, n + 1):
	now ^= a[i - 1]
	if i & 1:
		res += js[now]
		js[now] += 1
	else:
		res += os[now]
		os[now] += 1
print(res)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
l = list(map(int, input().split()))
even = []
odd = []
s = 0
for i in range(n):
	s = s ^ l[i]
	if i % 2 == 1:
		even.append(s)
	else:
		odd.append(s)
ans = 0
d = dict()
for i in range(len(even)):
	if even[i] in d:
		d[even[i]] += 1
	else:
		d.update({even[i]: 1})
for j in d:
	if j == 0:
		ans += d[j]
	ans += d[j] * (d[j] - 1) // 2
d = dict()
for i in range(len(odd)):
	if odd[i] in d:
		d[odd[i]] += 1
	else:
		d.update({odd[i]: 1})
for j in d:
	ans += d[j] * (d[j] - 1) // 2
print(ans)


n = int(input())
arr_str = input().split()
arr = [int(x) for x in arr_str]
cum_sum_arr = []
cum_sum_arr.append(0)
cum_sum = 0
for i in range(0, len(arr)):
	cum_sum = cum_sum ^ arr[i]
	cum_sum_arr.append(cum_sum)
count_pair = 0
sum2ind_odd = dict()
sum2ind_even = dict()
sum2ind_even[0] = 1
for r in range(1, len(cum_sum_arr)):
	if r % 2 == 0:
		if cum_sum_arr[r] in sum2ind_even:
			count_pair += sum2ind_even[cum_sum_arr[r]]
			sum2ind_even[cum_sum_arr[r]] += 1
		else:
			sum2ind_even[cum_sum_arr[r]] = 1
	elif cum_sum_arr[r] in sum2ind_odd:
		count_pair += sum2ind_odd[cum_sum_arr[r]]
		sum2ind_odd[cum_sum_arr[r]] += 1
	else:
		sum2ind_odd[cum_sum_arr[r]] = 1
print(count_pair)


n = int(input())
a = [int(v) for v in input().split()]
cnt = [[0] * 2 ** 20 for _ in range(2)]
cnt[1][0] = 1
x = 0
res = 0
for i in range(n):
	x ^= a[i]
	res += cnt[i % 2][x]
	cnt[i % 2][x] += 1
print(res)


n = int(input())
a = list(map(int, input().split()))
(x, cnt) = (0, 0)
s = [[0] * 2 ** 20 * 3, [0] * 2 ** 20 * 3]
s[1][0] = 1
for i in range(n):
	x ^= a[i]
	cnt += s[i % 2][x]
	s[i % 2][x] += 1
print(cnt)


from collections import defaultdict
n = int(input())
arr = list(map(int, input().split()))
xs = 0
dp = [0] * (n + 1)
d = defaultdict(list)
for i in range(n):
	xs = xs ^ arr[i]
	dp[i + 1] = xs
ct = 0
for i in range(n + 1):
	xs = dp[i]
	if xs not in d:
		d[xs].append(0)
		d[xs].append(0)
		if i % 2 == 0:
			d[xs][0] = 1
		else:
			d[xs][1] = 1
	elif i % 2 == 0:
		ct += d[xs][0]
		d[xs][0] += 1
	else:
		ct += d[xs][1]
		d[xs][1] += 1
print(ct)


n = int(input())
lis = list(map(int, input().split()))
mat = [[0] * (2 ** 20 + 5) for i in range(2)]
ans = a = 0
mat[1][0] = 1
for i in range(n):
	a = a ^ lis[i]
	ans += mat[i % 2][a]
	mat[i % 2][a] += 1
print(ans)


from itertools import accumulate
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
b = [0] + list(accumulate(a, lambda x, y: x ^ y))
c = list(Counter(sorted(b[::2])).values())
d = list(Counter(sorted(b[1::2])).values())
ans = 0
for i in c:
	ans += i * (i - 1) // 2
for i in d:
	ans += i * (i - 1) // 2
print(ans)


list_int_input = lambda inp: list(map(int, inp.split()))
int_input = lambda inp: int(inp)
string_to_list_input = lambda inp: list(inp)
n = int(input())
a = list_int_input(input())
a = [0] + a
xl = []
for (ind, val) in enumerate(a):
	if ind > 0:
		val = xl[-1] ^ val
	xl.append(val)
el = xl[::2]
ol = xl[1::2]
(de, do) = ({}, {})
for i in el:
	de.setdefault(i, 0)
	de[i] += 1
for i in ol:
	do.setdefault(i, 0)
	do[i] += 1
summ = 0
for (k, v) in de.items():
	summ += int(v * (v - 1) / 2)
for (k, v) in do.items():
	summ += int(v * (v - 1) / 2)
print(summ)


def main():
	n = int(input())
	arr = list(map(int, input().split()))
	pref = [None] * (n + 1)
	pref[0] = 0
	pref[1] = arr[0]
	funny = 0
	for i in range(1, n):
		pref[i + 1] = pref[i] ^ arr[i]
	even = dict()
	odd = dict()
	even[0] = 1
	for i in range(1, n + 1):
		if i & 1:
			if odd.get(pref[i]) != None:
				funny += odd[pref[i]]
				odd[pref[i]] += 1
			else:
				odd[pref[i]] = 1
		elif even.get(pref[i]) != None:
			funny += even[pref[i]]
			even[pref[i]] += 1
		else:
			even[pref[i]] = 1
	print(funny)
main()


n = int(input())
a = [int(x) for x in input().split()]
xor = [[0] * 2 ** 21 for i in range(2)]
xor[1][0] = 1
x = 0
ans = 0
for i in range(n):
	x ^= a[i]
	ans += xor[i % 2][x]
	xor[i % 2][x] += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
b = [0]
for i in range(n):
	b.append(b[-1] ^ a[i])
c = {}
for i in range(len(b)):
	c[b[i]] = []
for i in range(len(b)):
	c[b[i]].append(i % 2)
s = 0
for i in c:
	a = c[i].count(1)
	d = c[i].count(0)
	s = s + a * (a - 1) // 2 + d * (d - 1) // 2
print(s)


import sys
from collections import deque
import math
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
ip = lambda : input_()
fi = lambda : float(input_())
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
n = ii()
a = il()
ans = 0
x = 0
b = [0] * 2 ** 20
c = [0] * 2 ** 20
b[0] = 1
for i in range(n):
	x ^= a[i]
	if i % 2 == 0:
		ans += c[x]
		c[x] += 1
	else:
		ans += b[x]
		b[x] += 1
print(ans)


import collections
import heapq
import bisect
import math
import time

class Solution2:

	def solve(self, A1, A2):
		pass

def gcd(a, b):
	if not b:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return b * a // gcd(b, a)

class Solution:

	def solve(self, A):
		out = 0
		odd_dict = collections.defaultdict(int)
		odd_dict[0] = 1
		even_dict = collections.defaultdict(int)
		run_x = 0
		for i in range(len(A)):
			run_x ^= A[i]
			if i % 2:
				out += odd_dict[run_x]
				odd_dict[run_x] += 1
			else:
				out += even_dict[run_x]
				even_dict[run_x] += 1
		return out
sol = Solution()
sol2 = Solution2()
for test_case in range(1):
	N = input()
	b = [int(c) for c in input().split()]
	out = sol.solve(b)
	print(str(out))


def count(arr):
	even = 0
	odd = 0
	for i in arr:
		if i % 2 == 1:
			even += 1
		else:
			odd += 1
	return (even - 1) * even // 2 + (odd - 1) * odd // 2

def solve(a):
	sums = []
	x = 0
	for i in a:
		x = x ^ i
		sums.append(x)
	d = {}
	d[0] = [-1]
	for i in range(len(sums)):
		if sums[i] in d:
			d[sums[i]].append(i)
		else:
			d[sums[i]] = [i]
	res = 0
	for sums in d:
		res += count(d[sums])
	return res
n = int(input())
x = input().split()
a = []
for i in x:
	a.append(int(i))
print(solve(a))


import os, sys
from collections import defaultdict, Counter, deque
from io import BytesIO, IOBase
from math import gcd, inf

def ck(n, i):
	return n & 1 << i

def main():
	n = int(input())
	a = [int(x) for x in input().split()]
	dp = [0 for i in range(n)]
	x = defaultdict(lambda : 0)
	y = defaultdict(lambda : 0)
	y[0] = 1
	for i in range(0, n):
		dp[i] = dp[i - 1] ^ a[i]
		if i % 2:
			y[dp[i]] += 1
		else:
			x[dp[i]] += 1
	an = 0
	for i in x:
		an += 0
		an += x[i] * (x[i] - 1) // 2
	for i in y:
		an += 0
		an += y[i] * (y[i] - 1) // 2
	print(an)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from collections import defaultdict

def put():
	return map(int, input().split())
n = int(input())
l = list(put())
(even, odd) = (defaultdict(), defaultdict())
odd[0] = 1
xor = 0
for (i, j) in enumerate(l):
	xor ^= j
	if i % 2 == 0:
		if xor not in even:
			even[xor] = 1
		else:
			even[xor] += 1
	elif xor not in odd:
		odd[xor] = 1
	else:
		odd[xor] += 1
ans = 0
for (i, j) in even.items():
	ans += j * (j - 1) // 2
for (i, j) in odd.items():
	ans += j * (j - 1) // 2
print(ans)


import sys
from collections import defaultdict

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
a = get_array()
xor = 0
b = []
ans = 0
d = defaultdict(int)
for i in range(n):
	xor ^= a[i]
	if i % 2 == 1 and xor == 0:
		ans += 1
	b.append(xor)
d = defaultdict(list)
for i in range(len(b)):
	d[b[i]].append(i)
x = list(d.keys())
for i in range(len(x)):
	li = d[x[i]]
	(ans1, ans2) = (-1, -1)
	if li[0] % 2 == 0:
		ans1 = 0
	else:
		ans2 = 0
	for i in range(1, len(li)):
		if li[i] % 2 == 0:
			ans += ans1 + 1
			ans1 += 1
		else:
			ans += ans2 + 1
			ans2 += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
l = [0, a[0]]
for i in range(1, n):
	l.append(l[-1] ^ a[i])
(d, ans) = ({}, 0)
for i in range(n + 1):
	if l[i] not in d:
		d[l[i]] = [0, 0]
		d[l[i]][i % 2] = 1
	else:
		ans += d[l[i]][i % 2]
		d[l[i]][i % 2] += 1
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
pref = [0]
count = [[0, 0] for x in range(2 ** 20 + 10)]
for i in range(0, n):
	pref.append(pref[i] ^ a[i])
index = 0
ans = 0
for p in pref:
	ans += count[p][index % 2]
	count[p][index % 2] += 1
	index += 1
print(ans)


from math import sqrt, pow, ceil
from decimal import *
l1 = int(input())
l2 = input().split()
l2 = [int(i) for i in l2]
arr = [[0 for col in range(2000000)] for row in range(2)]
arr[1][0] = 1
a = 0
resp = 0
for i in range(l1):
	a ^= l2[i]
	resp += arr[i % 2][a]
	arr[i % 2][a] += 1
print(resp)


import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int, input().split()))
AX = [0, A[0]]
for i in range(1, n):
	AX.append(AX[i] ^ A[i])
LIST = sorted(set(AX))
DICT = dict()
for i in range(len(LIST)):
	DICT[LIST[i]] = i
NUMLIST = [[] for i in range(len(LIST))]
for i in range(n + 1):
	NUMLIST[DICT[AX[i]]].append(i)
ANS = 0
for lis in NUMLIST:
	l1 = [l for l in lis if l % 2 == 1]
	l2 = [l for l in lis if l % 2 == 0]
	ANS += len(l1) * (len(l1) - 1) // 2 + len(l2) * (len(l2) - 1) // 2
print(ANS)


n = int(input())
pref = [0]
app = pref.append
for (i, x) in enumerate(map(int, input().split())):
	app(pref[-1] ^ x)
(d, di) = ({}, {})
for (i, x) in enumerate(pref):
	if i % 2 == 0:
		if d.get(x) == None:
			d[x] = 0
		d[x] += 1
	else:
		if di.get(x) == None:
			di[x] = 0
		di[x] += 1
res = 0
for (i, x) in enumerate(d):
	res += d[x] * (d[x] - 1) // 2
for (i, x) in enumerate(di):
	res += di[x] * (di[x] - 1) // 2
print(res)


n = int(input())
ar = list(map(int, input().split()))
dic = {0: [0]}
xu = 0
for i in range(n):
	xu ^= ar[i]
	if xu in dic:
		dic[xu].append(i + 1)
	else:
		dic[xu] = [i + 1]
ans = 0
for i in dic:
	od = 0
	ev = 0
	for j in range(1, len(dic[i])):
		if (dic[i][j] - dic[i][0]) % 2 == 0:
			ev += 1
			ans += ev
		else:
			ans += od
			od += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
a = [0] + a
x = [0] * (n + 1)
c = {0: 1}
sol = 0
for i in range(1, n + 1):
	x[i] = x[i - 1] ^ a[i]
	if x[i] * 2 + i % 2 in c:
		sol += c[x[i] * 2 + i % 2]
	try:
		c[x[i] * 2 + i % 2] += 1
	except KeyError:
		c[x[i] * 2 + i % 2] = 1
print(sol)


from sys import stdin, stdout
nmbr = lambda : int(input())
lst = lambda : list(map(int, input().split()))
for _ in range(1):
	n = nmbr()
	a = lst()
	mp1 = {0: 1}
	mp0 = {}
	xor = ans = 0
	for i in range(n):
		xor ^= a[i]
		if i & 1:
			ans += mp1.get(xor, 0)
			mp1[xor] = mp1.get(xor, 0) + 1
		else:
			ans += mp0.get(xor, 0)
			mp0[xor] = mp0.get(xor, 0) + 1
	print(ans)


import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.version_info.minor >= 5:
	from math import gcd
else:
	from fractions import gcd
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul, xor
from copy import copy, deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def round(x):
	return int((x * 2 + 1) // 2)

def fermat(x, y, MOD):
	return x * pow(y, MOD - 2, MOD) % MOD

def lcm(x, y):
	return x * y // gcd(x, y)

def lcm_list(nums):
	return reduce(lcm, nums, 1)

def gcd_list(nums):
	return reduce(gcd, nums, nums[0])

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
N = INT()
A = LIST()
acc = [0] + list(accumulate(A, xor))
C1 = Counter()
for i in range(0, N + 1, 2):
	C1[acc[i]] += 1
C2 = Counter()
for i in range(1, N + 1, 2):
	C2[acc[i]] += 1
ans = 0
for (k, v) in C1.items():
	if v >= 2:
		ans += v * (v - 1) // 2
for (k, v) in C2.items():
	if v >= 2:
		ans += v * (v - 1) // 2
print(ans)


def get():
	return list(map(int, input().split()))
n = int(input())
a = get()
xor = (n + 1) * [0]
for i in range(1, n + 1):
	xor[i] = xor[i - 1] ^ a[i - 1]
ans = 0
b = [{}, {}]
for i in range(2):
	for j in range(i, n + 1, 2):
		if not xor[j] in b[i]:
			b[i][xor[j]] = 0
		ans += b[i][xor[j]]
		b[i][xor[j]] += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
xor = 0
arr = [[0] * 2 ** 20, [1] + [0] * (2 ** 20 - 1)]
count = 0
for i in range(n):
	xor = xor ^ a[i]
	count += arr[i % 2][xor]
	arr[i % 2][xor] += 1
print(count)


from itertools import accumulate
from collections import Counter
from operator import xor
print(sum((n * (n - 1) // 2 for n in list((Counter(((i & 1, e) for (i, e) in enumerate(accumulate([list(map(int, input().split())) for _ in range(2)][1], xor)))) + Counter([(1, 0)])).values()))))


def inpl():
	return list(map(int, input().split()))
from operator import xor
from itertools import accumulate, chain
from collections import Counter
N = int(input())
A = list(accumulate([0] + inpl(), xor))
B = [a for (i, a) in enumerate(A) if i % 2]
A = [a for (i, a) in enumerate(A) if not i % 2]
H1 = Counter(A)
H2 = Counter(B)
print(sum([h * (h - 1) // 2 for h in chain(H1.values(), H2.values())]))


def solve(a, n):
	x = 0
	mat = [[0 for i in range(10 ** 5)] for j in range(2)]
	res = 0
	odd = {}
	even = {0: 1}
	for i in range(n):
		x = x ^ a[i]
		if i % 2 == 0:
			res += odd.get(x, 0)
			odd[x] = odd.get(x, 0) + 1
		else:
			res += even.get(x, 0)
			even[x] = even.get(x, 0) + 1
	return res
n = int(input())
a = list(map(int, input().split()))
print(solve(a, n))


n = int(input())
lst = list(map(int, input().split()))
total = 0
for i in range(1, n):
	lst[i] = lst[i] ^ lst[i - 1]

def ikili(n):
	return n * (n - 1) / 2
dct = {0: [0, 0]}
for i in lst:
	dct[i] = [0, 0]
for i in range(n):
	if i % 2 == 0:
		dct[lst[i]][0] += 1
	else:
		dct[lst[i]][1] += 1
total += dct[0][1]
for i in dct:
	total += ikili(dct[i][0]) + ikili(dct[i][1])
print(int(total))


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
dic1 = {}
dic2 = {}
dic1[0] = 1
ans = 0
curr = 0
for i in range(n):
	curr = a[i] ^ curr
	if i % 2 == 0:
		if curr in dic2:
			ans += dic2[curr]
			dic2[curr] += 1
		else:
			dic2[curr] = 1
	elif curr in dic1:
		ans += dic1[curr]
		dic1[curr] += 1
	else:
		dic1[curr] = 1
print(ans)


from collections import defaultdict as dd
import math

def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return map(int, input().split())

def lm():
	return list(map(int, input().split()))
n = nn()
l = lm()
running = l[0]
dic = {(0, 0): 1, (running, 1): 1}
for i in range(1, len(l)):
	running = running ^ l[i]
	tup = (running, (i + 1) % 2)
	if tup in dic:
		dic[tup] += 1
	else:
		dic[tup] = 1
total = 0
for ele in dic:
	if dic[ele] >= 2:
		total = total + dic[ele] * (dic[ele] - 1) // 2
print(total)


n = int(input())
a = list(map(int, input().split()))
s = [0] * (n + 1)

def count_elements(L):
	even_elements = {}
	even_lst = L[0::2]
	odd_elements = {}
	odd_lst = L[1::2]
	for elem in even_lst:
		if elem in even_elements.keys():
			even_elements[elem] += 1
		else:
			even_elements[elem] = 1
	for elem in odd_lst:
		if elem in odd_elements.keys():
			odd_elements[elem] += 1
		else:
			odd_elements[elem] = 1
	elements = []
	for i in even_elements:
		elements.append(even_elements[i])
	for i in odd_elements:
		elements.append(odd_elements[i])
	return elements
s[0] = 0
s[1] = a[0]
i = 2
while i < n + 1:
	s[i] = s[i - 1] ^ a[i - 1]
	i += 1
b = count_elements(s)
ans = 0
for i in b:
	ans += int(i * (i - 1) / 2)
print(ans)


from collections import defaultdict as dd
seen = dd(list)
n = int(input())
A = [int(i) for i in input().split()]
seen[0] = [0, 1]
cumxor = 0
ans = 0
for i in range(n):
	newxor = cumxor ^ A[i]
	if i % 2 == 0:
		if newxor in seen:
			ans += seen[newxor][0]
			seen[newxor][0] += 1
		else:
			seen[newxor] = [1, 0]
	elif newxor in seen:
		ans += seen[newxor][1]
		seen[newxor][1] += 1
	else:
		seen[newxor] = [0, 1]
	cumxor = newxor
print(ans)


from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
t = [0] * n
t[0] = a[0]
for i in range(1, n):
	t[i] = t[i - 1] ^ a[i]
r = {0: defaultdict(int), 1: defaultdict(int)}
r[1][0] = 1
res = 0
for i in range(n):
	res += r[i % 2][t[i]]
	r[i % 2][t[i]] += 1
print(res)


from math import *

def binarySearch(arr, x, i):
	l = i
	r = len(arr) - 1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def js(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] <= x:
			ans = m
			l = m + 1
		else:
			r = m - 1
	return ans

def jg(arr, x, i):
	l = i
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] >= x:
			ans = m
			r = m - 1
		else:
			l = m + 1
	return ans
n = int(input())
a = list(map(int, input().split()))
p = [0, a[0]]
for i in range(1, n):
	p.append(p[-1] ^ a[i])
ans = 0
d1 = {}
d2 = {}
for i in range(n + 1):
	if i % 2 == 0:
		if d1.get(p[i]) == None:
			d1[p[i]] = 1
		else:
			ans += d1[p[i]]
			d1[p[i]] += 1
	elif d2.get(p[i]) == None:
		d2[p[i]] = 1
	else:
		ans += d2[p[i]]
		d2[p[i]] += 1
print(ans)


import math as mt
import sys, string
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
odd = defaultdict(int)
even = defaultdict(int)
n = I()
l = L()
x = [0, l[0]]
even[0] += 1
odd[l[0]] += 1
ans = 0
for i in range(1, n):
	x.append(x[-1] ^ l[i])
	if i % 2 == 1:
		even[x[-1]] += 1
		if even[x[-1]] == 2:
			ans += 1
		elif even[x[-1]] > 2:
			ans += even[x[-1]] - 1
	else:
		odd[x[-1]] += 1
		if odd[x[-1]] == 2:
			ans += 1
		elif odd[x[-1]] > 2:
			ans += odd[x[-1]] - 1
print(ans)


from collections import Counter
n = int(input())
a = [*map(int, input().split())]
pre = [[0] * 2 ** 20, [1] + [0] * (2 ** 20 - 1)]
t = ans = 0
for i in range(n):
	t ^= a[i]
	ans += pre[i & 1][t]
	pre[i & 1][t] += 1
print(ans)


n = int(input())
arr = list(map(int, input().split()))
count = 0
x = 0
cnt = [[0 for i in range((1 << 20) + 3)] for j in range(2)]
cnt[1][0] = 1
for i in range(n):
	x ^= arr[i]
	count += cnt[i % 2][x]
	cnt[i % 2][x] += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
cnt = [[0 for i in range(int(2 << 20) + 10)], [0 for i in range(int(2 << 20) + 10)]]
cnt[1][0] = 1
x = 0
ans = 0
for i in range(n):
	x ^= a[i]
	ans += cnt[i % 2][x]
	cnt[i % 2][x] += 1
print(ans)


from collections import Counter
N = int(input())
ls = list(map(int, input().split()))
pref = [0]
for i in ls:
	pref.append(pref[-1] ^ i)
odd = []
even = []
for i in range(len(pref)):
	if i % 2 == 0:
		odd.append(pref[i])
	else:
		even.append(pref[i])
odd = dict(Counter(odd))
even = dict(Counter(even))
cnt = 0
for (k, v) in odd.items():
	cnt += v * (v - 1) // 2
for (k, v) in even.items():
	cnt += v * (v - 1) // 2
print(cnt)


n = int(input())
s = list(map(int, input().rstrip().split()))
resp = [s[0]]
resd = [0, s[0] ^ s[1]]
for i in range(2, n):
	if i % 2 == 0:
		resp += [resd[-1] ^ s[i]]
	else:
		resd += [resp[-1] ^ s[i]]

def f(lis):
	dic = {}
	s = 0
	for el in lis:
		try:
			dic[el] += 1
		except:
			dic[el] = 1
	for d in dic:
		s += dic[d] * (dic[d] - 1) / 2
	return int(s)
print(f(resp) + f(resd))


maxn = int(300000.0) + 3
maxa = (1 << 20) + 3
nb_element = int(input())
arr = [int(x) for x in input().split()]
cnt = [[0 for _ in range(maxa)] for _ in range(2)]
cnt[1][0] = 1
xors = 0
res = 0
for i in range(nb_element):
	xors ^= arr[i]
	x = i % 2
	res += cnt[x][xors]
	cnt[x][xors] += 1
print(res)


n = int(input())
array = list(map(int, input().split()))
odd = dict()
even = dict()
sums = 0
odd[0] = [-1]
ans = 0
i = 0
while i < len(array):
	sums = sums ^ array[i]
	if i % 2 == 0 and sums in even:
		ans += len(even[sums])
		even[sums].append(i)
	elif i % 2 == 1 and sums in odd:
		ans += len(odd[sums])
		odd[sums].append(i)
	elif i % 2 == 0:
		even[sums] = [i]
	else:
		odd[sums] = [i]
	i += 1
print(ans)


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
from collections import Counter as C
n = ii()
a = li()
oe = [C(), C()]
oe[1][0] = 1
x = 0
ans = 0
for i in range(n):
	x ^= a[i]
	ans += oe[i % 2][x]
	oe[i % 2][x] += 1
print(ans)


from collections import defaultdict
N = int(input())
a = list(map(int, input().split()))
s = [0]
for i in range(N):
	s.append(s[-1] ^ a[i])
D1 = defaultdict(int)
D2 = defaultdict(int)
ans = 0
for i in range(N + 1):
	if i % 2 == 0:
		ans += D1[s[i]]
		D1[s[i]] += 1
	else:
		ans += D2[s[i]]
		D2[s[i]] += 1
print(ans)


from collections import defaultdict
n = int(input())
arr = list(map(int, input().split()))
ods = defaultdict(int)
evs = defaultdict(int)
xr = arr[0]
evs[xr] = 1
ods[0] = 1
ans = 0
for i in range(1, n):
	xr = xr ^ arr[i]
	if i % 2 == 0:
		ans += evs[xr]
		evs[xr] += 1
	else:
		ans += ods[xr]
		ods[xr] += 1
print(ans)


n = int(input())
A = list(map(int, input().split()))
even = {}
odd = {}
cnt = 0
B = [A[0]]
for i in range(1, n):
	B.append(B[-1] ^ A[i])
for u in B:
	even[u] = 0
	odd[u] = 0
for x in range(n):
	if x % 2 == 0:
		even[B[x]] += 1
	else:
		odd[B[x]] += 1
for t in even:
	cnt += even[t] * (even[t] - 1) // 2
	cnt += odd[t] * (odd[t] - 1) // 2
if 0 in odd:
	print(cnt + odd[0])
else:
	print(cnt)


from __future__ import print_function
from sys import stdin
from math import log2, ceil, sqrt, gcd, log
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
rr = lambda x: reversed(range(x))
mod = int(1000000000.0) + 7
inf = float('inf')
(n,) = gil()
a = gil()
cnt = [{}, {0: 1}]
ans = 0
xr = 0
for i in range(n):
	xr ^= a[i]
	ans += cnt[i & 1].get(xr, 0)
	cnt[i & 1][xr] = cnt[i & 1].get(xr, 0) + 1
print(ans)


n = int(input())
arr = list(map(int, input().strip().split()))
mp = {}
pre = [0] * n
pre[0] = arr[0]
for i in range(1, n):
	pre[i] = pre[i - 1] ^ arr[i]
ans = 0
for i in range(n):
	x = 0 ^ pre[i]
	if x in mp:
		ans += mp[x][(i + 1) % 2]
	if pre[i] == 0:
		if (i + 1) % 2 == 0:
			ans += 1
	if pre[i] in mp:
		mp[pre[i]][(i + 1) % 2] += 1
	else:
		a = []
		if (i + 1) % 2 == 0:
			a = [1, 0]
		else:
			a = [0, 1]
		mp[pre[i]] = a
print(ans)


n = int(input())
a = list(map(int, input().split()))
xor = [a[0]]
for i in range(1, n):
	xor.append(xor[-1] ^ a[i])
d = {0: [1, 0]}
for i in range(n):
	if xor[i] not in d:
		d[xor[i]] = [0, 0]
	d[xor[i]][(i + 1) % 2] += 1
funny = 0
for k in d:
	odd = d[k][1]
	even = d[k][0]
	funny += odd * (odd - 1) // 2
	funny += even * (even - 1) // 2
print(funny)


n = int(input())
b = {(0, 0): 1}
(ans, i, x) = (0, 0, 0)
for a in map(int, input().split()):
	x ^= a
	i += 1
	t = b.get((x, i % 2), 0)
	ans += t
	b[x, i % 2] = t + 1
print(ans)


input()
N = 1 << 20
d = ([1] + [0] * N, [0] * N)
r = s = i = 0
for x in map(int, input().split()):
	s ^= x
	i ^= 1
	r += d[i][s]
	d[i][s] += 1
print(r)


n = int(input())
a = [int(x) for x in input().split()]
d0 = {}
d1 = {}
c = 0
count = 0
for i in range(n):
	c = c ^ a[i]
	if c == 0 and i % 2 == 1:
		count = count + 1
	if i % 2 == 0:
		l = d0.get(c, 0)
		count = count + l
		if l == 0:
			d0[c] = 0
		d0[c] = d0[c] + 1
	else:
		l = d1.get(c, 0)
		count = count + l
		if l == 0:
			d1[c] = 0
		d1[c] = d1[c] + 1
print(count)


from collections import defaultdict
a = int(input())
z = list(map(int, input().split()))
ans = [0, z[0]]
for i in range(1, len(z)):
	ans.append(ans[-1] ^ z[i])
al = defaultdict(list)
al = defaultdict(lambda : [0, 0], al)
for i in range(len(ans)):
	if i % 2 == 1:
		al[ans[i]][1] += 1
	else:
		al[ans[i]][0] += 1
kamp = list(set(ans))
total = 0
for i in range(len(kamp)):
	x = al[kamp[i]][0]
	y = al[kamp[i]][1]
	total += x * (x - 1) // 2 + y * (y - 1) // 2
print(total)


input()
d = {(0, 0): 1}
r = s = i = 0
for x in map(int, input().split()):
	s ^= x
	i ^= 1
	c = d.get((s, i), 0)
	r += c
	d[s, i] = c + 1
print(r)


import math as mt
import bisect
import sys
input = sys.stdin.readline
import collections
import heapq
t = 1
p = 10 ** 9 + 7

def ncr_util():
	inv[0] = inv[1] = 1
	fact[0] = fact[1] = 1
	for i in range(2, 300001):
		inv[i] = inv[i % p] * (p - p // i) % p
	for i in range(1, 300001):
		inv[i] = inv[i - 1] * inv[i] % p
		fact[i] = fact[i - 1] * i % p

def solve():
	d1 = {}
	d2 = {}
	d1[0] = 1
	(xori, ans) = (0, 0)
	for i in range(n):
		xori ^= l[i]
		if i % 2 == 0:
			ans += d2.get(xori, 0)
			d2[xori] = d2.get(xori, 0) + 1
		else:
			ans += d1.get(xori, 0)
			d1[xori] = d1.get(xori, 0) + 1
	return ans
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	print(solve())


n = int(input())
mas = list(map(int, input().split()))
prefxor = [0]
for i in range(n):
	prefxor.append(prefxor[-1] ^ mas[i])
aaa = [[0] + [0] * max(prefxor)] + [[0] + [0] * max(prefxor)]
for i in range(len(prefxor)):
	aaa[i % 2][prefxor[i]] += 1
ans = 0
for i in range(2):
	for j in range(len(aaa[i])):
		ans += aaa[i][j] * (aaa[i][j] - 1) // 2
print(ans)


n = int(input())
a = list(map(int, input().split()))
preXor = [0] * n
preXor[0] = a[0]
for i in range(1, n):
	preXor[i] = a[i] ^ preXor[i - 1]
even = {}
odd = {}
count = 0
for i in range(n):
	m = preXor[i]
	if m == 0:
		if i % 2 == 1:
			count += 1
	if i % 2 == 0:
		if m in even:
			count += even[m]
			even[m] += 1
		else:
			even[m] = 1
	elif m in odd:
		count += odd[m]
		odd[m] += 1
	else:
		odd[m] = 1
print(count)


n = int(input())
a = list(map(int, input().split()))
b = [0]

def calc(i):
	e = 0
	o = 0
	for j in i:
		if j % 2:
			e += 1
		else:
			o += 1
	return e * (e - 1) // 2 + o * (o - 1) // 2
for i in a:
	b.append(b[-1] ^ i)
k = list(set(b))
d1 = {}
for i in range(len(k)):
	d1[k[i]] = i
d = [[] for i in range(len(k))]
for i in range(n + 1):
	d[d1[b[i]]].append(i)
ans = 0
for i in d:
	ans += calc(i)
print(ans)