from itertools import accumulate from typing import Any, Sequence MOD = int(1e9 + 7) def countSubseq(s: Sequence[Any]) -> int: """O(n)求不同子序列个数(非空)""" n = len(s) dp = [0] * (n + 1) dp[0] = 1 last = dict() for i, char in enumerate(s): dp[i + 1] = 2 * dp[i] % MOD if char in last: dp[i + 1] -= dp[last[char]] last[char] = i return (dp[n] - 1) % MOD n = int(input()) nums = list(map(int, input().split())) nums = list(accumulate(nums, lambda x, y: x ^ y)) nums.pop() print((countSubseq(nums) + 1) % MOD)