Count Of Subarrays With Equal Number Of Zeroes And Ones

easy
1. You are given an array that contains only 0s and 1s.
2. You have to find the count of subarrays with equal number of 0s and 1s.

Input Format

A number N arr1 arr2.. N numbers

Output Format

A number representing count of subarrays with equal number of 0s and 1s.

Constraints

1 <= N <= 10^5
0 <= arr[i] <= 1

Example

Input
6
0 1 1 0 1 1
Output
4
Previous
Longest Subarray With Equal Number Of Zeroes And Ones
Next
Longest Subarray With Equal Number Of 0s 1s And 2s

Related Questions