Var i, j, h, a, z, n, k: integer;
array1: array [1..100] of integer;
array2: array [1..100] of integer;
procedure swap(var x, y: integer);
var t: integer;
begin
t := x; x := y; y := t
end;
begin
randomize;
write('Введите значение N: ');
readln(n);
for i := 1 to n do
begin
array1[i] := random(10) + 1;
end;
for i := 1 to n do
begin
writeln('Массив:');
for i := 1 to n do write(array1[i], ' ');
writeln;
end;
for h := 1 to n - 1 do
for z := 1 to n - h do
if array1[z] > array1[z + 1] then
swap(array1[z], array1[z + 1]);
for i := 1 to n do
begin
writeln('После сортировки:');
for i := 1 to n do write(array1[i], ' ');
writeln;
end;
for i:=1 to n do
begin
k := 0;
for j := 1 to n do
if array1[i] <> array1[j] then k:=k+1;
if k = n - 1 then array2[i] := array1[i];
end;
for i := 1 to n do
if array2[i] > 0 then a := a + 1;
writeln('Различных чисел: ', a);
end.