program main
  integer::N
  integer,parameter::a=LEN_TRIM("")
  integer,parameter::b=LEN_TRIM("a")
  integer,parameter::c=LEN_TRIM("aa")
  integer,parameter::d=LEN_TRIM("aaa")
  integer,parameter::e=LEN_TRIM("aaaa")
  integer,parameter::f=LEN_TRIM("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
  character(len=e)::cf='(i )'
  integer,allocatable::isPr(:)
  write(cf(d:d),'(a)'), ACHAR(f)
  read cf,N
  allocate(isPr(N))
  call get_pr(isPr,N)
  if(isPr(N).eq.a) then
     print '(a)',"NO"
  else
     print '(a)',"YES"
  end if
contains
  subroutine get_pr(isPr, N)
    implicit none
    integer::i,j,N
    integer,parameter::pr=b,nonpr=a
    integer,allocatable::isPr(:)

    isPr=pr
    isPr(b)=nonpr
    do i=c, FLOOR(SQRT(REAL(N)))
       if(isPr(i).eq.pr) then
          do j=ISHFT(i,b), N, i
             isPr(j) = nonpr
          end do
       end if
    end do
  end subroutine get_pr
end program main