N=int(eval(input()))

k=2

ans=1

factors=[]

i=1

while i*i<N-1:

  if (N-1)%i==0:

    ans+=1

  i+=1

while k*k<=N:

  n=0

  while pow(k,n)<=N:

    if (N-pow(k,n))%(pow(k,n+1))==0:

      ans+=1

      break

    n+=1

  k+=1

print(ans)
n=int(eval(input()))

ans=set()

ans.add(n)

i=2

x = 1

while x * x <= n-1 :

  if (n-1) % x == 0:          

    ans.add(x)

    ans.add((n-1)//x)

  x += 1

while i*i<=n:

  t=n

  while t%i==0:

    t/=i

  if t%i==1:

    ans.add(i)

  i+=1

print((len(ans)-1))
N = int(eval(input()))
k = 2
ans = 1
factors = []
i = 1
while i * i < N - 1:
    if (N - 1) % i == 0:
        ans += 1
    i += 1
while k * k <= N:
    n = 0
    while pow(k, n) <= N:
        if (N - pow(k, n)) % (pow(k, n + 1)) == 0:
            ans += 1
            break
        n += 1
    k += 1
print(ans)

n = int(eval(input()))
ans = set()
ans.add(n)
i = 2
x = 1
while x * x <= n - 1:
    if (n - 1) % x == 0:
        ans.add(x)
        ans.add((n - 1) // x)
    x += 1
while i * i <= n:
    t = n
    while t % i == 0:
        t /= i
    if t % i == 1:
        ans.add(i)
    i += 1
print((len(ans) - 1))

-N = int(eval(input())) -k = 2 -ans = 1 -factors = [] -i = 1 -while i * i < N - 1: -    if (N - 1) % i == 0: -        ans += 1 +n = int(eval(input())) +ans = set() +ans.add(n) +i = 2 +x = 1 +while x * x <= n - 1: +    if (n - 1) % x == 0: +        ans.add(x) +        ans.add((n - 1) // x) +    x += 1 +while i * i <= n: +    t = n +    while t % i == 0: +        t /= i +    if t % i == 1: +        ans.add(i) -while k * k <= N: -    n = 0 -    while pow(k, n) <= N: -        if (N - pow(k, n)) % (pow(k, n + 1)) == 0: -            ans += 1 -            break -        n += 1 -    k += 1 -print(ans) +print((len(ans) - 1))