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

import Control.Monad
import Data.Bits
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Sequence as Sq
import Data.Sequence ((|>), ViewL(..))

data Shaku = Shaku (Sq.Seq Int) Int Int [Int] (Shaku -> Maybe(Int, Shaku))

solve as = (t-) $ sum $ unfoldr (\sh@(Shaku _ _ _ _ f) -> f sh) $ Shaku Sq.empty 0 0 as ext
    where
        n = length as
        t = (n * (n-1)) `div` 2 + n

ext (Shaku _ _ _ [] _) = Nothing
ext (Shaku sq su xo aa@(a:as) _) =
    if su' == xo' then  Just(0, Shaku sq' su' xo' as ext)
                  else  Just(length aa, Shaku sq' su' xo' as shr)
    where
        su' = su + a
        xo' = xo `xor` a
        sq' = sq |> a

shr (Shaku (Sq.viewl -> Sq.EmptyL) _ _ as _) = Just(0, Shaku Sq.empty 0 0 as ext)
shr (Shaku (Sq.viewl -> d :< sq') su xo as _) =
    if su' == xo' then  Just(0, Shaku sq' su' xo' as ext)
                  else  Just(length as + 1, Shaku sq' su' xo' as shr)
    where
        su' = su - d
        xo' = xo `xor` d

main = do
    _ <- getLine
    as <- unfoldr (B.readInt.B.dropWhile (==' ')) <$> B.getLine
    print $ solve as