Skip to main content
LIVE CONTEST: ALGOR Contest: Round #4 (Special Challenge) is live now!

~/algor $ cat problems/bit-xori-k-qism-massivlar

Subarrays with XOR equal to k

Medium 1000 ms 128 MB 55%
Share

An array of $n$ non-negative integers and a number $k$ are given. How many contiguous subarrays have the XOR of their elements ($a_{l} \oplus a_{l+1} \oplus \ldots \oplus a_{r}$, $l \le r$) equal to $k$?

Prefix XORs under the array; subarrays with XOR equal to k are marked with brackets

Input

The first line contains two integers: $n$ and $k$. The second line contains $n$ integers $a_{i}$.

Output

One integer — the number of subarrays.

Note

$1 \le n \le 2 \cdot 10^{5}$
$0 \le k, a_{i} \lt 2^{30}$

Examples

Input #1
5 6
4 2 2 6 4
Output #1
4
Input #2
1 0
0
Output #2
1

Sign in to submit a solution

Signing up is free and takes a minute.