$mod = 10**9+7

def pow(a,b)
  if b == 1
    a
  elsif b%2 == 0
    (pow(a,b/2)**2)%$mod
  else
    (a*pow(a,b/2)**2)%$mod
  end
end

def create_fact(n)
  for i in 2..n
    $fact[i] = ($fact[i-1]*i)%$mod
  end
end

def create_fact_inv(n)
  $fact_inv[n] = pow($fact[n],$mod-2)
  n.downto(1) do |i|
    $fact_inv[i-1] = ($fact_inv[i]*i)%$mod
  end
end

def create_inv(n)
  for i in 1..n
    $inv[i] = ($fact[i-1]*$fact_inv[i])%$mod
  end
end

def create_table(n)
  $fact = Array.new(n+1,1)
  $fact_inv = Array.new(n+1,1)
  $inv = Array.new(n+1,0)
  create_fact(n)
  create_fact_inv(n)
  create_inv(n)
end

def combi(a,b)
  (($fact[a]*$fact_inv[b])%$mod)*$fact_inv[a-b]%$mod
end
$mod
create_table(500010)
n = gets.to_i
a = gets.split.map(&:to_i)
b = Array.new(n+1,0)
x = Array.new(n+1,0)
y = z = 1
x[0] = x[1] = 1
for i in 2..n
    if i%2 == 0
        x[i] += y
        z += x[i]
    else
        x[i] += z
        y += x[i]
    end
end

n.times do |i|
    b[i+1] = a[i]^b[i]
end
ans = 0
if b[-1] == 0
    cnt = Hash.new(0)
    place = Hash.new(-1)
    z = 0
    y = 0
    for i in 1..n
        if b[i] != 0 && place[b[i]] < z
            cnt[b[i]] += 1
            place[b[i]] = i
        elsif b[i] == 0
            z = i
            y += 1
        end
    end
    cnt.values.each do |i|
        ans += x[i*2]*2
        ans %= $mod
    end
    puts (ans+2**(y-1))%$mod
else
    $mod
    cnt = 0
    c = b[-1]
    place = -1
    z = 0
    y = 0
    for i in 1..n
        if b[i] == c && place < z
            cnt += 1
            place = i
        elsif b[i] == 0
            z = i
        end
    end
    puts x[cnt*2-1]
end