You are given an array of integers. You perform the following action exactly once: choose a non-empty subsegment of the array and order its elements in non-decreasing order.
How many different arrays can you obtain? A subsegment of an array is a collection of several consecutive elements.
The first line contains a single integer $$$n$$$ — the size of the array ($$$1 \le n \le 200\,000$$$).
The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ... $$$a_n$$$ — the contents of the array ($$$1 \le a_i \le 10^9$$$).
Output a single integer — the number of different arrays you can obtain by sorting a subsegment once.
| Subtask | Points | Constraints |
| 1 | 13 | $$$n \le 50$$$ |
| 2 | 26 | $$$n \le 3\,000$$$ |
| 3 | 22 | $$$1 \le a_i \le 2$$$ |
| 4 | 39 | No additional constraints |
7 3 1 4 1 5 9 2
8
4 1 2 3 4
1
Listed below are all eight achievable arrays in the first example. Square brackets indicate the sorted subsegment.
| Name |
|---|


