#2731. 连续子序列异或的和(Hard)

连续子序列异或的和(Hard)

Background

Special for beginners, ^_^

Description

给定一个长度为 NN 的整数序列 A=(A1,,AN)A=(A_1,\ldots,A_N)

求所有长度大于 1 的连续子序列异或的和。

Format

Input

第一行一个正整数 N1<N107N(1<N\le10^7) ,表示数组的长度。

第二行给出 NN 个不超过 10810^8 的正整数。

Output

在一行中输出答案。

Samples

6
1 1 4 5 1 4
34

Limitation

1s, 1024KiB for each test case.