문제
The United Cows of Farmer John (UCFJ) are sending a delegation to the International bOvine olympIad (IOI).
There are
cows participating in delegation selection (
The delegation will consist of a contiguous interval of at least three cows - that is, cows
Help the UCFJ determine (for tax reasons) the number of ways they might choose a delegation to send to the IOI. Two delegations are considered different if they have different members or different leaders.
입력
The first line contains
The second line contains
출력
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
9
Each delegation corresponds to one of the following triples of leaders: