{-# LANGUAGE RankNTypes, TupleSections #-}
import Control.Monad.State
import Control.Monad.ST
import Data.Array.ST
import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import Data.Foldable
import qualified Data.Vector as V
import Data.Bits

main :: IO ()
main = getLine >> readLine >>= print . solve

solve :: [Int] -> Int
solve as = runST (initialize >>= stLoop [0..(m - 1)] . edit)
    where
        bs = scanl1 xor as
        cs = map head . group $ sort bs
        vs = V.fromList bs
        ws = V.fromList cs
        n = V.length vs
        m = V.length ws

        initialize :: ST s (Table s Key Int)
        initialize = newArray ((0, 0, False), (V.length ws, n, True)) Nothing

        edit = (0,)

        stLoop (x : xs) (p, t) = add p <$> (runMemo calc (x, 0, True) t >>= stLoop xs)
        stLoop _ (p, _) = return p

        calc f (x, y, b)
            | y == n - 1 && v == w = return 1
            | y == n - 1 = return 0
            | v == w = add <$> f (x, y + 1, not b) <*> f (x, y + 1, b)
            | otherwise = f (x, y + 1, b)
            where
                v = vs V.! y
                w 
                    | b = ws V.! x
                    | otherwise = 0

type Key = (Int, Int, Bool)

readLine :: IO [Int]
readLine = unfoldr (fmap (second (maybe B.empty snd . B.uncons)) . B.readInt) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine

infixl 6 `add`
infixl 7 `mul`

add :: Int -> Int -> Int
add x y = val $ x + y

mul :: Int -> Int -> Int
mul x y = val $ x * y

inv :: Int -> Int
inv x = pow x $ modVal - 2

pow :: Int -> Int -> Int
pow b e
    | e == 0 = 1
    | odd e = mul b . pow b $ e - 1
    | otherwise = mul v v
    where
        v = pow b $ e `div` 2

val :: Int -> Int
val = (`mod` modVal)

modVal :: Int
modVal = 10 ^ 9 + 7

primes :: [Int]
primes = build [2..]
    where
        build (x : xs) = x : build (filter (\n -> n `mod` x /= 0) xs)
        
isPrime :: Int -> Bool
isPrime n = check primes
    where
        check (x : xs)
            | x == n = True
            | x > n = False
            | otherwise = check xs


type Table s a b = STArray s a (Maybe b)
type Memo s a b = a -> StateT (Table s a b) (ST s) b

evalMemo :: (Ix a) => (forall s. Memo s a b -> Memo s a b) -> a -> Table s a b -> ST s b
evalMemo f k = evalStateT (memoizeFix f k)

runMemo :: (Ix a) => (forall s. Memo s a b -> Memo s a b) -> a -> Table s a b -> ST s (b, Table s a b)
runMemo f k = runStateT (memoizeFix f k)

memoizeFix :: (Ix a) => (forall s. Memo s a b -> Memo s a b) -> forall s. Memo s a b
memoizeFix f k = get >>= (\arr -> lift (readArray arr k) >>= maybe (f (memoizeFix f) k >>= ((<$) <*> (lift . writeArray arr k . Just))) return)