An array B is good if B only consists of consecutive integers when sorted.
Given an array A of n integers. Count the number of good subarray in A.
### Input
- The first line contains an integer n.
- The next line contains n integers Ai.
### Output
- Print the number of good subarrays.
### Constraints
- 1≤n≤105.
- 1≤Ai≤n.
### Example
Input:
3123
Output:
6