Count Of All Subarrays With Zero Sum

medium
1. You are given an array(arr) of integers.
2. You have to find the count of all subarrays with sum 0.

Input Format

A number N arr1 arr2.. N numbers

Output Format

A number representing the count of all subarrays with sum 0.

Constraints

1 <= N <= 10^6
1 <= arr[i] <= 10^4

Example

Input
8
15 -2 2 -8 1 7 10 23
Output
3
Previous
Largest Subarray With Contiguous Elements
Next
Smallest Substring Of A String Containing All Characters Of Another String

Related Questions