#P1438E. Yurii Can Do Everything
Yurii Can Do Everything
No submission language available for this problem.
Description
Yurii is sure he can do everything. Can he solve this task, though?
He has an array consisting of positive integers. Let's call a subarray good if the following conditions are simultaneously satisfied:
- , i. e. the subarray has length at least ;
- , where denotes the bitwise XOR operation.
In other words, a subarray is good if the bitwise XOR of the two border elements is equal to the sum of the rest of the elements.
Yurii wants to calculate the total number of good subarrays. What is it equal to?
An array is a subarray of an array if can be obtained from by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end.
The first line contains a single integer () — the length of .
The second line contains integers () — elements of .
Output a single integer — the number of good subarrays.
Input
The first line contains a single integer () — the length of .
The second line contains integers () — elements of .
Output
Output a single integer — the number of good subarrays.
Samples
Note
There are good subarrays in the example:
- (twice) because ;
- (twice) because ;
- because ;
- because .