{-# OPTIONS_GHC -O #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}

import Control.Monad
import Data.Bits ((.&.), xor)
import qualified Data.Vector.Storable as V
import qualified Data.ByteString.Char8 as B

data Dat = Dat Int Int Int (V.Vector Int) Int

shaku (Dat b e x va n)
    | e >= n        = Nothing
    | x .&. ve == 0 = Just(e-b+1, Dat  b   (e+1) (x `xor` ve) va n)
    | otherwise     = Just(0,     Dat (b+1) e    (x `xor` vb) va n)
    where
        vb = va V.! b
        ve = va V.! e

main = do
    _ <- getLine
    as <- V.unfoldr (B.readInt.B.dropWhile (==' ')) <$> B.getLine
    print $ V.foldl1' (+) $ V.unfoldr shaku $ Dat 0 0 0 as (V.length as)