Lauren And Inversions
One day, when Lauren was walking, she found a permutation of numbers between to . She decided she wanted to minimize the number of inversions in this permutation, so she decided to swap two of the indices. But she is not sure which two indices she should swap so that it minimizes the number of inversions. Can you help her?
Number of inversions in array is the number of pairs such that, and .
Input Format
The first line contains N, which represents the number of elements of the permutation. The next line contains N space-separated elements of the permutation.
Constraints
For full score:
For score:
Output Format
If there isn't any such that, swapping them reduces the number of inversions, print "Cool Array" without the quotes, else print and . If there is more than one pair, print the small one. Consider is smaller than , if or, and .
Sample Input
6
1 5 6 3 4 2
Sample Output
2 6
Explanation
The number of inversions at start are equal to . After swapping, the new permutation will be , and the number of inversions will be
xxxxxxxxxx
with Ada.Text_IO, Ada.Integer_Text_IO;
use Ada;
procedure Solution is
-- Enter your code here. Read input from STDIN. Print output to STDOUT
end Solution