import Data.Bits
import Data.List

subLists :: [a] -> [[a]]
subLists = concatMap (tail . inits) . tails

solve :: [Int] -> Int
solve = length . filter p . subLists
  where p xs = all (\(x,y) -> x .&. y == 0) (zip (scanl1 (+) xs) (tail xs))

main :: IO ()
main = do
  _n <- getLine
  as <- map read . words <$> getLine
  print $ solve as
