Given an array of length ~N~, partition it into one or more contiguous groups. Once partitioned, take the XOR of the elements in each group. Compute the sum of these values. Bessie wants this sum to be minimal, Farmer John wants the sum to be maximal. Compute the difference between their sums.
The first line of the input contains a single positive integer, ~N~. You may assume ~N \le 10^5~.
The second line of the input will contain ~N~ space-separated integers, the integers of the array in order. These integers will be less than ~10^9~.
Print on a single line the difference between the sums Bessie and Farmer John compute.
5 1 2 4 8 16