//FPC 2.6.4
const
m = 3; n = 3;
var
a : array[1..n, 1..m] of integer;
max1: array[1..n] of integer;
min1: array[1..n] of integer;
max2: array[1..m] of integer;
min2: array[1..m] of integer;
i, j, min, max, count: integer;
begin
for i:=1 to n do
for j:=1 to m do
begin
write ('Введите элемент матрицы [', i, ', ', j, ']: ');
readln (a[i, j]);
end;
for i:=1 to n do
begin
min:=a[i, 1]; max:=a[i, 1];
for j:=2 to m do
begin
if a[i, j] if a[i, j]>max then max:=a[i, j];
end;
min1[i]:=min; max1[i]:=max;
end;
for j:=1 to m do
begin
min:=a[1, j]; max:=a[1, j];
for i:=2 to n do
begin
if a[i, j] if a[i, j]>max then max:=a[i, j];
end;
min2[j]:=min; max2[j]:=max;
end;
writeln;
writeln ('Введенная матрица: ');
for i:=1 to n do
begin
for j:=1 to m do write (a[i, j]:6);
writeln;
end;
writeln;
count:=0;
for i:=1 to n do
for j:=1 to m do
if ((a[i, j]=max1[i]) and (a[i, j]=min2[j]))
or ((a[i, j]=max2[j]) and (a[i, j]=min1[i])) then
begin
writeln ('Седловая точка: [', i, ', ', j, ']');
inc (count);
end;
writeln ('Всего седловых точек: ', count);
end.