Equivalent Subarrays

medium
1. You are given an array of integers(arr).
2. You have to find the count of equivalent subarrays.
3. A subarray is equivalent if,
   count of unique integers in the subarray = count of unique integers in the given array.

Input Format

A number N arr1 arr2... N numbers

Output Format

A number representing count of equivalent subarrays.

Constraints

1 <= N <= 10^5
-2^31 <= arr[i] <= 2^31-1

Example

Input
5
2 1 3 2 3
Output
5
Previous
Count Of Substrings With Exactly K Unique Characters
Next
Maximum Consecutive Ones - 1

Related Questions