N = gets.to_i
a = gets.split.map(&:to_i)
MOD = 10**9+7
csum = [0]*(N+1)
N.times do |i|
  csum[i+1] = csum[i] ^ a[i]
end

if csum[-1] != 0
  dp = Array.new(N+1){[1,0]}
  N.times do |i|
    if csum[i+1] == 0
      dp[i+1][0] = (dp[i][0] + dp[i][1]) % MOD
      dp[i+1][1] = dp[i][1]
    elsif csum[i+1] == csum[-1]
      dp[i+1][1] = (dp[i][0] + dp[i][1]) % MOD
      dp[i+1][0] = dp[i][0]
    else
      dp[i+1][0] = dp[i][0]
      dp[i+1][1] = dp[i][1]
    end
  end
  p (dp[N][1]-1) % MOD
else
  cnt = 0
  prev = [0]*(2**20)
  rle = Array.new(2**20){[]}
  N.times do |i|
    if csum[i+1] == 0
      cnt += 1
    else
      x = csum[i+1]
      rle[x] << [0,cnt-prev[x]] if cnt > prev[x]
      rle[x] << [x,1]
      prev[x] = cnt
    end
  end

  ans = 0
  rle.each do |cs|
    dp = Array.new(cs.length+1){[1,0]}
    cs.each do |x,k|
      if x == 0
        a0 = dp[-1][0] + dp[-1][1] * k
        a0 %= MOD
        dp << [a0,dp[-1][1]]
      else
        a1 = dp[-1][0] * k + dp[-1][1]
        a1 %= MOD
        dp << [dp[-1][0],a1]
      end
    end
    ans += (dp[-1][1]) % MOD

  end
  p (ans+2**(cnt-1)) % MOD
end