Var
x, y: array[1..100] of integer;
i, n, k: integer;
min, max: integer;
begin
{ввод массива}
write('n = ');
readln(n);
writeln('Данные массива:');
for i := 1 to n do
begin
readln(x[i]);
end;
writeln();
{минимум и максимум}
max := x[1];
min := x[1];
for i := 1 to n do
begin
if max < x[i] then max := x[i];
if min > x[i] then min := x[i];
end;
writeln('max = ', max);
writeln('min = ', min);
writeln('avg = ', (max + min) / 2);
max := (max + min) / 2;
k := 0;
for i := 1 to n do
begin
if x[i] >= max then begin
k := k + 1;
y[k] := x[i];
write(y[k], ' ');
end;
end;
end.