$|=<>;@A=glob<>; for$i(0..$#A){ $A[$i]>$A[$_]and($A[$i],$A[$_])=($A[$_],$A[$i]),push@_,"$i $_\n"for 0..$#A } print@_.$/,@_ ;<>