def isprime_Miller(n): if n==2: return True if n==1 or n&1==0: return False if n < (1<<32): witness = [2,7,61] else: witness = [2, 325, 9375, 28178, 450775, 9780504, 1795265022] # n < (1<<64) でOK #elif n < (1<<61): witness = [2,3,5,7,11,13,17,19,23] #if n in witness: return True d = n-1 while d&1==0: d >>= 1 for a in witness: t = d y = pow(a,t,n) while t != n-1 and y != 1 and y != n-1: y = y*y%n t <<= 1 if y != n-1 and t&1 == 0: return False return True # coding: utf-8 # Your code here! import sys readline = sys.stdin.readline read = sys.stdin.read #a,b,c = map(int,readline().split()) n = int(input()) print("NO" if isprime_Miller(n) else "YES")