import Data.List
main=print.f=<<readLn
f n=length$u[]a$filter(g n)b where
  [a,b]=map(d[]2)[n-1,n]
g n i=case n`mod`i of
  0 -> g(n`div`i)i
  1 -> True
  _ -> False
d r i m
  |i*i>m=reverse.sort$if m>1 then m:r else r
  |m`mod`i==0=d(m`div`i:i:r)(i+1)m
  |otherwise=d r(i+1)m
u r[][]=r
u r as bs
  |a>b=u(a:r)(tail as)bs
  |a<b=u(b:r)as(tail bs)
  |otherwise=u(a:r)(tail as)(tail bs)
  where [a,b]=map v[as,bs]
v as=if null as then 0 else head as