import sys,math,copy,queue,itertools,bisect

NI = lambda : int(sys.stdin.readline())

INF = 10**18



N = NI()

if N == 2:

    print((1))

    exit (0)

ans = 0

max_b = int(math.log(N,2))

for x in range(2,int(math.sqrt(N-1))+1):

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

        if (N-1) == x**2:

            ans += 1

        else:

            ans += 2

for x in range(1, int(math.sqrt(N)) + 1):

    if N % x == 0:

        for b in range(1,max_b+1):

            k = round(x**(1/b))

            if k**b == x and k > 1:

                if (N//x-1) % k == 0:

                    ans += 1

            if x**2 != N:

                x = N // x

                k = round(x ** (1 / b))

                if k ** b == x and k > 1:

                    if (N // x - 1) % k == 0:

                        ans += 1



print((ans+1))



import sys,queue,math,copy,itertools,bisect,collections,heapq



def main():

    NI = lambda : int(sys.stdin.readline())



    N = NI()

    max_i = int(math.log2(N))

    div = []

    for i in range(1,int(math.sqrt(N))+1):

        if N % i == 0:

            div.append((i,N//i)); div.append((N//i,i))



    ans = 0

    for a,b in div:

        if a == 1:

            for i in range(1,int(math.sqrt(b-1))+1):

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

                    p = 2 - (i*i == b-1) - (i == 1)

                    ans += p

        else:

            for i in range(1,max_i+1):

                c = round(math.pow(a,1/i))

                if c ** i == a:

                    if b % c == 1: ans += 1

    print(ans)



if __name__ == '__main__':

    main()
import sys, math, copy, queue, itertools, bisect

NI = lambda: int(sys.stdin.readline())
INF = 10**18
N = NI()
if N == 2:
    print((1))
    exit(0)
ans = 0
max_b = int(math.log(N, 2))
for x in range(2, int(math.sqrt(N - 1)) + 1):
    if (N - 1) % x == 0:
        if (N - 1) == x**2:
            ans += 1
        else:
            ans += 2
for x in range(1, int(math.sqrt(N)) + 1):
    if N % x == 0:
        for b in range(1, max_b + 1):
            k = round(x ** (1 / b))
            if k**b == x and k > 1:
                if (N // x - 1) % k == 0:
                    ans += 1
            if x**2 != N:
                x = N // x
                k = round(x ** (1 / b))
                if k**b == x and k > 1:
                    if (N // x - 1) % k == 0:
                        ans += 1
print((ans + 1))

import sys, queue, math, copy, itertools, bisect, collections, heapq


def main():
    NI = lambda: int(sys.stdin.readline())
    N = NI()
    max_i = int(math.log2(N))
    div = []
    for i in range(1, int(math.sqrt(N)) + 1):
        if N % i == 0:
            div.append((i, N // i))
            div.append((N // i, i))
    ans = 0
    for a, b in div:
        if a == 1:
            for i in range(1, int(math.sqrt(b - 1)) + 1):
                if (b - 1) % i == 0:
                    p = 2 - (i * i == b - 1) - (i == 1)
                    ans += p
        else:
            for i in range(1, max_i + 1):
                c = round(math.pow(a, 1 / i))
                if c**i == a:
                    if b % c == 1:
                        ans += 1
    print(ans)


if __name__ == "__main__":
    main()

-import sys, math, copy, queue, itertools, bisect +import sys, queue, math, copy, itertools, bisect, collections, heapq -NI = lambda: int(sys.stdin.readline()) -INF = 10**18 -N = NI() -if N == 2: -    print((1)) -    exit(0) -ans = 0 -max_b = int(math.log(N, 2)) -for x in range(2, int(math.sqrt(N - 1)) + 1): -    if (N - 1) % x == 0: -        if (N - 1) == x**2: -            ans += 1 + +def main(): +    NI = lambda: int(sys.stdin.readline()) +    N = NI() +    max_i = int(math.log2(N)) +    div = [] +    for i in range(1, int(math.sqrt(N)) + 1): +        if N % i == 0: +            div.append((i, N // i)) +            div.append((N // i, i)) +    ans = 0 +    for a, b in div: +        if a == 1: +            for i in range(1, int(math.sqrt(b - 1)) + 1): +                if (b - 1) % i == 0: +                    p = 2 - (i * i == b - 1) - (i == 1) +                    ans += p -            ans += 2 -for x in range(1, int(math.sqrt(N)) + 1): -    if N % x == 0: -        for b in range(1, max_b + 1): -            k = round(x ** (1 / b)) -            if k**b == x and k > 1: -                if (N // x - 1) % k == 0: -                    ans += 1 -            if x**2 != N: -                x = N // x -                k = round(x ** (1 / b)) -                if k**b == x and k > 1: -                    if (N // x - 1) % k == 0: +            for i in range(1, max_i + 1): +                c = round(math.pow(a, 1 / i)) +                if c**i == a: +                    if b % c == 1: -print((ans + 1)) +    print(ans) + + +if __name__ == "__main__": +    main()