program so_hoan_hao;
var
n, tong_uoc, i: integer;
begin
writeln('Nhap vao mot so nguyen duong n:');
readln(n);
tong_uoc := 0;
for i := 1 to n-1 do
begin
if n mod i = 0 then
tong_uoc := tong_uoc + i;
end;
if tong_uoc = n then
writeln('YES')
else
writeln('NO');
end.