1. You are given an array(arr) of N numbers.
2. You have to select three indices i,j,k following this condition ->
0 <= i < j <= k < arr.length
3. Two numbers X and Y as defined as :
X = arr[i] ^ arr[i+1] ^ ... ^ arr[j - 1]
Y = arr[j] ^ arr[j+1] ^ ... ^ arr[k]
4. You have to print the number of triplets where X is equal to Y.Input Format
A number N arr1 arr2.. n numbers
Output Format
Check the sample ouput and question video.
Constraints
1 <= N <= 1000 0 <= arr[i] <= 10^9
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
3 1 2 3
Output
2