##
var n := ReadInteger;
var a := ArrRandom(n, -500, 500);
a.Println;
var (imax, imin) := (a.IndexMax, a.IndexMin);
Swap(a[imax], a[imin]);
a.Print
##
var n := ReadInteger;
var a := ArrRandom(n, -500, 500);
a.Println;
var (imax, imin) := (a.IndexMax, a.IndexMin);
Swap(a[imax], a[imin]);
a.Print