output_description: Print the answer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      A_1 A_2 \ldots A_{N}
attempt: def xor(a, b):
      x = 0
      i = 1
      while a != 0 or b != 0:
          an = a % 2
          bn = b % 2
          if an != bn:
              x += i
          a //= 2
          b //= 2
          i *= 2
      return x
  
  
  N = int(input())
  a = list(map(int, input().split()))
  
  MOD = 1e9 + 7
  
  L = [0] * N
  L[0] = a[0]
  
  Z = [0] * (N + 1)
  Z[1] = 1
  for i in range(1, N):
      Z[i + 1] = int(Z[i] * 2 % MOD)
  
  for i in range(1, N):
      L[i] = xor(L[i - 1], a[i])
  
  D = [0] * N
  if L[0] == 0:
      D[0] = 1
  
  for i in range(1, N):
      D[i] = D[i - 1]
      if L[i] == 0:
          D[i] += 1
  
  if L[-1] == 0:
      Ans = Z[D[-1]]
  
      R = {}
      for i in range(N - 1):
          t = L[i]
          if t != 0:
              if t not in R:
                  R[t] = [[1, i]]
              else:
                  k = R[t][-1][1]
                  if D[k] == D[i]:
                      R[t][-1][0] += 1
                  else:
                      R[t].append([D[i] - D[k], -1])
                      R[t].append([1, i])
      print(Ans)
      for i in R.values():
          t = i
          t.append([D[-1] - D[i[-1][1]], -1])
          k = 1
          for j in range(0, len(t), 2):
              k *= t[j][0] * t[j + 1][0]
          Ans += k - 1
  print(Ans)
  
problem_description: Statement
  
  The _beauty_ of a sequence a of length n is defined as a_1 \oplus \cdots
  \oplus a_n, where \oplus denotes the bitwise exclusive or (XOR).
  
  You are given a sequence A of length N. Snuke will insert zero or more
  partitions in A to divide it into some number of non-empty contiguous
  subsequences.
  
  There are 2^{N-1} possible ways to insert partitions. How many of them divide
  A into sequences whose beauties are all equal? Find this count modulo
  10^{9}+7.
samples: [{"input": "3\n    1 2 3", "output": "3\n    \n\nFour ways of dividing A shown below satisfy the condition. The condition is\nnot satisfied only if A is divided into (1),(2),(3).\n\n  * (1,2,3)\n  * (1),(2,3)\n  * (1,2),(3)\n\n* * *"}, {"input": "3\n    1 2 2", "output": "1\n    \n\n* * *"}, {"input": "32\n    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", "output": "147483634\n    \n\nFind the count modulo 10^{9}+7.\n\n* * *"}, {"input": "24\n    1 2 5 3 3 6 1 1 8 8 0 3 3 4 6 6 4 0 7 2 5 4 6 2", "output": "292"}]