Program n1;
uses crt;
const nn=1000;
var
i,j,n,k:integer;
m: array[1..nn,1..nn] of integer;
begin
randomize;
writeln('Введите размерность массива'); readln(n);
for i:=1 to n do
for j:=1 to n do m[i,j]:=random(100)-50;
for i:=1 to n do begin
for j:=1 to n do write(m[i,j]:4,' ');
writeln; end;
for i:=1 to n do
for j:=1 to n do
if (i=j) and (m[i,j]>0) then k:=k+1;
writeln(k);
end.