Solve this simple problem in c++:

A Stanford researcher has been trying to figure out a new way to measure the happiness of undergraduate students. They surveyed 𝑁
N
students and stored their reported happiness levels in an array.

You are given an array of size 𝑁
N
 with integer values. We want to partition the array into one or more contiguous subarrays. The happiness level of a partition is the sum of the bitwise XOR of the numbers in each subarray. We want to compute the maximum happiness and the minimum happiness possible with this array. Output the difference between these values.

Definitions: A subarray is defined as a contiguous segment of an array. In array: [4, 3, 7, 2, 1] some subarrays are [4, 3, 7] and [7, 2]. [4, 2, 1] is not a subarray.

The bitwise XOR (Exclusive Or), is an operator similar to addition. However, it is performed on each bit of a number. For each bit in a number, the XOR of the two bits are 0, if the arguments are the same, else the XOR is 1. XOR(0,0) = 0 XOR(1,1) = 0 XOR(1,0) = 1 XOR(0,1) = 1

Input
The first line of input holds a single integer 𝑁
N
 (1≤𝑁≤10,000
1
≤
N
≤
10
,
000
). The next 𝑁
N
 lines each contain a single value 𝑣𝑖
v
i
 (1≤𝑣𝑖≤220
1
≤
v
i
≤
2
20
), which are the values in the array.

Output
Print, on a single line, an integer representing the difference between the minimum happiness and the maximum happiness attainable.