def make_divs(n):

    divs = []

    

    for i in range(1, int(n**0.5)+1):

        if n%i==0:

            divs.append(i)

            

            if i!=n//i:

                divs.append(n//i)

    

    return divs



N = int(eval(input()))

divs = make_divs(N)

ans = 0



for d in divs:

    if d==1:

        continue

    

    N2 = N

    

    while N2%d==0:

        N2 //= d

    

    if (N2-1)%d==0:

        ans += 1



divs = make_divs(N-1)

ans += len(divs)-1



print(ans)
import sys

input = sys.stdin.readline

from collections import *



def make_divs(n):

    divs = []

    i = 1

    

    while i*i<=n:

        if n%i==0:

            divs.append(i)

            

            if i!=n//i:

                divs.append(n//i)

        

        i += 1

    

    return divs



N = int(eval(input()))

ds = make_divs(N)

ans = 0



for d in ds:

    if d==1:

        continue

    

    N2 = N

    

    while N2%d==0:

        N2 //= d

    

    if (N2-1)%d==0:

        ans += 1

    

ans += len(make_divs(N-1))-1

print(ans)
def make_divs(n):
    divs = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divs.append(i)
            if i != n // i:
                divs.append(n // i)
    return divs


N = int(eval(input()))
divs = make_divs(N)
ans = 0
for d in divs:
    if d == 1:
        continue
    N2 = N
    while N2 % d == 0:
        N2 //= d
    if (N2 - 1) % d == 0:
        ans += 1
divs = make_divs(N - 1)
ans += len(divs) - 1
print(ans)

import sys

input = sys.stdin.readline
from collections import *


def make_divs(n):
    divs = []
    i = 1
    while i * i <= n:
        if n % i == 0:
            divs.append(i)
            if i != n // i:
                divs.append(n // i)
        i += 1
    return divs


N = int(eval(input()))
ds = make_divs(N)
ans = 0
for d in ds:
    if d == 1:
        continue
    N2 = N
    while N2 % d == 0:
        N2 //= d
    if (N2 - 1) % d == 0:
        ans += 1
ans += len(make_divs(N - 1)) - 1
print(ans)

+import sys + +input = sys.stdin.readline +from collections import * + + -    for i in range(1, int(n**0.5) + 1): +    i = 1 +    while i * i <= n: +        i += 1 -divs = make_divs(N) +ds = make_divs(N) -for d in divs: +for d in ds: -divs = make_divs(N - 1) -ans += len(divs) - 1 +ans += len(make_divs(N - 1)) - 1