Совершенное число — натуральное число, равное сумме всех своих собственных делителей (т. е. всех положительных делителей, отличных от самого числа)
program PascalGuru;
function soversh(x:integer):boolean;
var i,sum:integer;
begin
sum:=0;
for i:=x-1 downto 1 do
if x mod i = 0 then sum:=sum+i;
if sum = x
then soversh:=true
else soversh:=false;
end;
{-----------------------------------------}
var i,n,count:integer;
A:array [1..50] of integer;
begin
write('Vvedite razmer posledovatelinosti: ');readln(n);
writeln('Vvedite samu posledovatelinosti:');
for i:=1 to n do
begin
write(i,': ');
readln(A[i]);
end;
writeln('Vot vvedennaya posledovatelinosti:');
for i:=1 to n do write(A[i]:5);
count:=0;
for i:=1 to n do
if soversh(A[i]) then inc(count);
writeln;writeln('Kolichestvo sovershenyh chisel: ',count);
readln;
end.