{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import           Data.Bits             (xor)
import qualified Data.ByteString.Char8 as BC
import           Data.List             (unfoldr)
import           Data.Maybe            (fromJust)
import           Data.Vector.Unboxed   (Vector, (!))
import qualified Data.Vector.Unboxed   as V

main :: IO ()
main = do
  n <- readLn
  as <- map readInt . BC.words <$> BC.getLine
  print $ solve n as

solve :: Int -> [Int] -> Int
solve n as = sum $ twoPointMethod n as' where
  as' = V.fromList as

twoPointMethod :: Int -> Vector Int -> [Int]
twoPointMethod n as = unfoldr f (0, 0, 0) where
  f (l, r, s)
    | l >= n    = Nothing
    | l == r'   = Just (0, (l + 1, r' + 1, s'))
    | otherwise = Just (r' - l, (l + 1, r', s' - as!l)) where
        (r', s') = last . takeUntil p $ iterate g (r, s)
        p (r, s) = r < n && s `xor` as!r == s + as!r
        g (r, s) = (r + 1, s + as!r)

takeUntil :: (a -> Bool) -> [a] -> [a]
takeUntil _ []     = []
takeUntil p (x:xs) = x : if p x then takeUntil p xs else []

readInt :: BC.ByteString -> Int
readInt = fst . fromJust . BC.readInt
