Question
Prize Badges for Contest Ranks

A school gives prize badges to N students standing in a line. Each student has a performance score. Every student must get at least one badge. If a student has a higher score than an immediate neighbour, that student must receive more badges than that neighbour.

Find the minimum total number of badges needed.

Input

The first line contains an integer KaTeX can only parse string typed expression.

The second line contains KaTeX can only parse string typed expression integers — the performance scores.

Output

Print a single integer — the minimum total number of badges.

Example
Example 1:
Input
3

1 2 2
Output
4


Example 2:
Input
5

1 3 4 5 2
Output
11

Online