CF193D Two Segments
Description
Nick has some permutation consisting of $ p $ integers from $ 1 $ to $ n $ . A segment $ [l,r] $ ( $ l
Input Format
N/A
Output Format
N/A
Explanation/Hint
In the first sample the following pairs of segments are good: ( $ [1,1] $ , $ [2,2] $ ); ( $ [2,2] $ , $ [3,3] $ ); ( $ [1,2] $ , $ [3,3] $ ). Pair of segments ( $ [1,1] $ , $ [2,3] $ ) is by definition equivalent to pair ( $ [1,2] $ , $ [3,3] $ ), since both of them covers the same set of elements, namely $ {1,2,3} $ .
In the third sample the following pairs of segments are good: ( $ [4,4] $ , $ [5,5] $ ); ( $ [3,3] $ , $ [4,5] $ ); ( $ [2,2] $ , $ [3,5] $ ); ( $ [1,1] $ , $ [2,5] $ ); ( $ [3,3] $ , $ [5,5] $ ); ( $ [2,3] $ , $ [5,5] $ ); ( $ [1,3] $ , $ [5,5] $ ); ( $ [2,2] $ , $ [3,3] $ ); ( $ [1,1] $ , $ [2,3] $ ); ( $ [1,1] $ , $ [2,2] $ ).