문제
The United Cows of Farmer John (UCFJ) are sending a delegation to the International bOvine olympIad (IOI).
There are cows participating in delegation selection (). They are standing in a line, and cow has breed .
The delegation will consist of a contiguous interval of at least two cows - that is, cows for integers and satisfying . The two outermost cows of the chosen interval will be designated as "leaders." To avoid intra-breed conflict, every leader must be of a different breed from the rest of the delegation (leaders or not).
Help the UCFJ determine (for tax reasons) the number of ways they might choose a delegation to send to the IOI.
입력
The first line contains .
The second line contains integers , each in the range .
출력
The number of possible delegations, on a single line.
Note that the large size of integers involved in this problem may require the use of 64-bit integer data types (e.g., a "long long" in C/C++).
예제 입력 1
7
1 2 3 4 3 2 5
예제 출력 1
13
점수
Test cases 1-3 satisfy .Test cases 4-8 satisfy .Test cases 9-20 satisfy no additional constraints.
코드를 제출하려면 로그인이 필요합니다.
로그인