- Time limit: 1.00 s
- Memory limit: 512 MB
Given an array of integers, count the number of subarrays where each element is dictinct.
Input
The first line has an integer : the array size.
The second line has integers : the array contents.
Output
Print the number of subarrays with distinct elements.
Constraints
Example
Input:
4 1 2 1 3
Output:
8
Explanation: The subarrays are (two times), , , , , and .