import qualified Control.Monad.State.Lazy as State
import Control.Monad.State.Lazy (State)
import qualified Data.Bits as Bits
import qualified Data.ByteString.Char8 as BS
import qualified Data.Char as Char
import qualified Data.Text as Text
import qualified Data.Text.IO as Text
import qualified Data.Vector.Unboxed.Mutable as UMVector
import qualified Data.Vector.Unboxed as UVector
import Data.Vector.Unboxed ((!))
--
-- xorLengths' :: UVector.Vector Int -> Int -> Int -> Int
-- xorLengths' as l xorVal
-- 	| l >= UVector.length as =
-- 	| xorVal' == xorVal + next = xorLength' (l + 1) xorVal'
-- 	where
-- 		next = as ! l
-- 		xorVal' = xorVal `Bits.xor` next

type XorLengthState = State (Int, Int)

xorLengths' :: UVector.Vector Int -> [Int] -> XorLengthState [Int]
xorLengths' as acc
	| UVector.null as = return acc
	| otherwise       = do
		(l, xorVal) <- State.get
		let current = as ! 0
		let next = as ! l
		let xorVal' = xorVal `Bits.xor` next
		let nextXor = xorVal `Bits.xor` current
		if l >= UVector.length as || xorVal' /= xorVal + next then do
			State.put (l - 1, nextXor)
			xorLengths' (UVector.tail as) (l:acc)
		else do
			State.put (l + 1, xorVal')
			xorLengths' as acc

main :: IO ()
main = do
	n <- readLn
	as <- UVector.unfoldrN n (BS.readInt . BS.dropWhile Char.isSpace) <$> BS.getLine
	-- print $ sum $ xorLengths as 0 0 []
	print $ sum $ fst $ State.runState (xorLengths' as []) (0, 0)
