#DIVERTA2019E. XOR Partitioning

XOR Partitioning

Score : 800800 points

Problem Statement

The beauty of a sequence aa of length nn is defined as a1ana_1 \oplus \cdots \oplus a_n, where \oplus denotes the bitwise exclusive or (XOR).

You are given a sequence AA of length NN. Snuke will insert zero or more partitions in AA to divide it into some number of non-empty contiguous subsequences.

There are 2N12^{N-1} possible ways to insert partitions. How many of them divide AA into sequences whose beauties are all equal? Find this count modulo 109+710^{9}+7.

Constraints

  • All values in input are integers.
  • 1N5×1051 \leq N \leq 5 \times 10^5
  • 0Ai<2200 \leq A_i < 2^{20}

Input

Input is given from Standard Input in the following format:

NN

A1A_1 A2A_2 \ldots ANA_{N}

Output

Print the answer.

3
1 2 3
3

Four ways of dividing AA shown below satisfy the condition. The condition is not satisfied only if AA is divided into (1),(2),(3)(1),(2),(3).

  • (1,2,3)(1,2,3)
  • (1),(2,3)(1),(2,3)
  • (1,2),(3)(1,2),(3)
3
1 2 2
1
32
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
147483634

Find the count modulo 109+710^{9}+7.

24
1 2 5 3 3 6 1 1 8 8 0 3 3 4 6 6 4 0 7 2 5 4 6 2
292