Index of rightmost smallest element
if arr [ i ] <= minn : NEW_LINE INDENT minn = arr [ i ] NEW_LINE r = i NEW_LINE DEDENT if r < l : NEW_LINE print ( l + ( n - r - 2 ) ) NEW_LINE else : NEW_LINE print ( l + ( n - r - 1 ) ) NEW_LINE