import           Data.List

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

solve :: [Int] -> Int
solve = length . filter (== 0) . concat .map (scanl1 (+)) . init . tails
