def make_div(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)

    

    divs.sort()

    

    return divs



N = int(eval(input()))

d = make_div(N)

d = d[1:]

s = set()



for di in d:

    N2 = N

    

    while N2%di==0:

        N2 //= di

    

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

        s.add(di)



d = make_div(N-1)

d = d[1:]



for di in d:

    s.add(di)



print((len(s)))
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)
def make_div(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)
    divs.sort()
    return divs


N = int(eval(input()))
d = make_div(N)
d = d[1:]
s = set()
for di in d:
    N2 = N
    while N2 % di == 0:
        N2 //= di
    if (N2 - 1) % di == 0:
        s.add(di)
d = make_div(N - 1)
d = d[1:]
for di in d:
    s.add(di)
print((len(s)))

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)

-def make_div(n): +def make_divs(n): -    divs.sort() -d = make_div(N) -d = d[1:] -s = set() -for di in d: +divs = make_divs(N) +ans = 0 +for d in divs: +    if d == 1: +        continue -    while N2 % di == 0: -        N2 //= di -    if (N2 - 1) % di == 0: -        s.add(di) -d = make_div(N - 1) -d = d[1:] -for di in d: -    s.add(di) -print((len(s))) +    while N2 % d == 0: +        N2 //= d +    if (N2 - 1) % d == 0: +        ans += 1 +divs = make_divs(N - 1) +ans += len(divs) - 1 +print(ans)