Const
n = 10;
var
a: array[1..n] of integer;
i: integer;
function sum: integer;
var
tmp, prev, cur, s, i: integer;
flg: boolean;
begin
s := 0;
for i := 1 to n do
begin
flg := true;
tmp := a[i];
prev := 9;
cur := 0;
while tmp > 0 do
begin
cur := tmp mod 10;
if cur > prev then
begin
flg := false;
break;
end;
prev := cur;
tmp := tmp div 10;
end;
if flg then inc(s);
end;
sum := s;
end;
begin
writeln('Исходный массив: ');
for i := 1 to n do
begin
a[i] := random(1000);
write(a[i], ' ');
end;
writeln;
writeln('Ответ: ', sum);
end.