Loading repovive.com/contests/0/problems/B
Given an array of distinct positive integers.
A pair of indices with is called stable if:
(the pair is increasing), AND
There is no index with such that
In other words, a stable pair is an increasing pair where no element strictly between positions and has a value strictly between and .
Count the number of stable pairs.