AtCoder Grand Contest 005
翻译中…
Problem Statement
翻译中…
One day, Snuke was given a permutation of length $N$, $a_1, a_2, ..., a_N$, from his friend.
翻译中…
Find the following:
翻译中…

翻译中…
Constraints
翻译中…
$1 ≦ N ≦ 200,000$$(a_1, a_2, ..., a_N)$is a permutation of$(1, 2, ..., N)$.
翻译中…
Input
翻译中…
The input is given from Standard Input in the following format:
翻译中…
N
a_1 a_2 ... a_N
翻译中…
Output
翻译中…
Print the answer.
翻译中…
Note that the answer may not fit into a 32-bit integer.
翻译中…
样例
Input #1
3
2 1 3
Output #1
9
Input #2
4
1 3 2 4
Output #2
19
Input #3
8
5 4 8 1 2 6 7 3
Output #3
85
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。