- Time limit: 1.00 s
- Memory limit: 512 MB
Given an array of integers, your task is to calculate the number of subarrays that have at most distinct values.
Input
The first input line has two integers and .
The next line has integers : the contents of the array.
Output
Print one integer: the number of subarrays.
Constraints
Example
Input:
5 2 1 2 3 1 1
Output:
10