You are given an array of
A subarray of length
Constraints
Subtask 1 [5%]
Subtask 2 [10%]
Subtask 3 [15%]
Subtask 4 [20%]
Subtask 5 [25%]
Subtask 6 [25%]
Input Specification
The first line of input contains one integer:
The second line of input contains
Output Specification
Output one number: the number of subarrays that have a majority element.
Sample Input 1
Copy
4
1 2 1 3
Sample Output 1
Copy
5
Explanation for Sample Output 1
All
Sample Input 2
Copy
10
1 3 2 3 1 3 3 2 2 4
Sample Output 2
Copy
25
Comments