N = gets.to_i
M = 10 ** 9 + 7

a_list = gets.strip.split(/ /).collect(&:to_i)

total = a_list.inject(:^)

zero_counts = []

x = 0
zero_count = 0
x_table = { 0=> [] }
a_list.each_with_index{|a, i|
	x ^= a
	if x == 0
		zero_count += 1
	end
	zero_counts << zero_count
	if l = x_table[x]
		l << i
	else
		x_table[x] = [i]
	end
}

r = x

count = 0

if r == 0
	count += (2 ** (x_table[0].length - 1)) % M
	x_table.each{|x, list|
		if x > 0
			cu = 1
			cnx = 0
			cnz = 1
			prev = zero_counts[list[0]]
			list[1..-1].each{|i|
				z = zero_counts[i] - prev
				new_cu = (cu * z + cnx) % M
				new_cnx = (cu + cnx * z) % M
				new_cnz = (cnz * (z + 1)) % M
				cu = new_cu
				cnx = new_cnx
				cnz = new_cnz
				prev = zero_counts[i]
			}
			count = (count + cu + cnz - 1) % M
		end
	}
else
	if list = x_table[r]
		cu = 1
		cnx = 0
		cnz = 1
		prev = zero_counts[list[0]]
		list[1..-1].each{|i|
			z = zero_counts[i] - prev
			new_cu = (cu * z + cnx) % M
			new_cnx = (cu + cnx * z) % M
			new_cnz = (cnz * (z + 1)) % M
			cu = new_cu
			cnx = new_cnx
			cnz = new_cnz
			prev = zero_counts[i]
		}
		count = (count + cu + cnz) % M
	else
		count = 1
	end
end
puts count
