Begin
var c, min, imin: integer;
c := 0;
var ar := readarrinteger('Массив:',readinteger());
for var i := 1 to ar.Length do
begin
min := ar[c];
imin := c;
for var j := c to ar.Length - 1 do
begin
if(ar[j] < min) then
begin
min := ar[j];
imin := j;
end;
end;
swap(ar[c], ar[imin]);
c := c + 1;
end;
write('После сортировки: ');
ar.Println;
write('Различных чисел: ',ar.Distinct.Count);
end.