#include <bits/stdc++.h>
using namespace std;

int main() {
	int arr[] = {10, 5, 2, 7, 1, 9};
	int n = sizeof(arr) / sizeof(arr[0]);
	int k = 15;
	int pairs = 0;
	
	unordered_map<int, int> mp;
	//if XOR(i…j) = k then P(i-1) = k XOR k = 0 so we store 0 already in map beforehand
	//specially for cases where valid subarray starts from index 0 itself
	mp[0] = 1;                     // prefix XOR of empty subarray is 0
	
	int currentXor = 0;
	for (int j = 0; j < n; j++) {
		currentXor ^= arr[j];             
		int toFind = currentXor ^ k;	
		pairs += mp[toFind];
		mp[currentXor]++;
	}
	cout << pairs;
	return 0;
}
