p=int(input())
O=abs(False)
I=abs(True)
II=abs(~True) 
III=sum([I,II]) 
a=II if p!=II else III
if pow(a,sum([p,~O]),p)==I and p!=sum((ord('»'),ord('»'),ord('»'))):
  print("YES")
else:
  print("NO")