import Data.Bits
import Debug.Trace

main = do
  n <- read <$> getLine :: IO Int
  as <- map read . words <$> getLine :: IO [Int]
  print $ solve as

solve :: [Int] -> Int
solve as =
  traceShow ("as",as) $
  ans
  where
    ans = check (as,as,0) 0 0

check ([],_,_) _ res = res
check (als@(al:als'), ars@([]), len) accum res =
  check (als', ars, len-1) (xor accum al) $ res+len-1  
check (als@(al:als'), ars@(ar:ars'), len) accum res =
--  traceShow ("l="++show als,"r="++ show ars,"acc="++show accum,"len="++show len,"res="++show res) $
  if len == 0 then
    check (als, ars', len+1) (xor accum ar) $ res+1
  else if 0 == (accum .&. ar) then
    check (als, ars', len+1) (xor accum ar) $ res+1
  else
    check (als', ars, len-1) (xor al accum) $ res+len-1
    


  