XOR Sum 3

Compute the XOR of every contiguous subsequence of A and print the sum of all those XOR values.

Medium6Bit manipulationPrefix sumMathInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

The XOR sum of a sequence is the value obtained by XORing all of its elements together.

Given a sequence AA, write a program that computes the XOR sum of every contiguous subsequence of AA and outputs the total of all those XOR sums.

Input

The first line contains the length NN of the sequence. (1N100000)(1 \le N \le 100\,000)

The second line contains the NN elements of AA, separated by spaces. Each element is a non-negative integer not exceeding 10910^9.

Output

Print the sum of the XOR sums of all contiguous subsequences of AA on the first line.