{PROGRAM bai_tap;
USES crt ;
VAR i , n, t:integer;
BEGIN
clrscr;
Write('Nhap n');Readln(n);
t:=0;
For i:=1 to n-1 do
if n mod i=0 then t:=t+i;
if t=n then write(n,' la so hoan chinh');
else Writeln(n,' Khong la so hoan chinh');
Readlnnline Pascal Compiler.
begin
End,
Readlnnline
END.
}
#include <bits/stdc++.h>
using namespace std;
long long n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n/2; i++)
if (n%i==0) t=t+i;
if (t==n) cout<<"YES";
else cout<<"NO";
return 0;
}