N = int(eval(input()))

cnt = 2 if N > 2 else 1



ret = []

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

    if N % i == 0:

        k = N//i

        while k % i == 0:

            k //= i

        if k % i == 1:

            cnt += 1



        if N // i != i:

            j = N // i

            k = i

            while k % j == 0:

                k //= j

            if k % j == 1:

                cnt += 1



M = N - 1

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

    if M % i == 0:

        cnt += 1

        if M // i != i:

            cnt += 1



print(cnt)

N = int(eval(input()))



def divisor(N):

    ret = []

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

        if N % i == 0:

            ret.append(i)

            if N // i != i:

                ret.append(N//i)

    return ret





div_N = divisor(N)

div_N_1 = divisor(N-1)



ans = 0



for k in div_N[1:]:

    n = N

    while n % k == 0:

        n //= k

    if n % k == 1:

        ans += 1



ans += len(div_N_1) - 1



print(ans)

N = int(eval(input()))
cnt = 2 if N > 2 else 1
ret = []
for i in range(2, int(N**0.5) + 1):
    if N % i == 0:
        k = N // i
        while k % i == 0:
            k //= i
        if k % i == 1:
            cnt += 1
        if N // i != i:
            j = N // i
            k = i
            while k % j == 0:
                k //= j
            if k % j == 1:
                cnt += 1
M = N - 1
for i in range(2, int((M) ** 0.5) + 1):
    if M % i == 0:
        cnt += 1
        if M // i != i:
            cnt += 1
print(cnt)

N = int(eval(input()))


def divisor(N):
    ret = []
    for i in range(1, int(N**0.5) + 1):
        if N % i == 0:
            ret.append(i)
            if N // i != i:
                ret.append(N // i)
    return ret


div_N = divisor(N)
div_N_1 = divisor(N - 1)
ans = 0
for k in div_N[1:]:
    n = N
    while n % k == 0:
        n //= k
    if n % k == 1:
        ans += 1
ans += len(div_N_1) - 1
print(ans)

-cnt = 2 if N > 2 else 1 -ret = [] -for i in range(2, int(N**0.5) + 1): -    if N % i == 0: -        k = N // i -        while k % i == 0: -            k //= i -        if k % i == 1: -            cnt += 1 -        if N // i != i: -            j = N // i -            k = i -            while k % j == 0: -                k //= j -            if k % j == 1: -                cnt += 1 -M = N - 1 -for i in range(2, int((M) ** 0.5) + 1): -    if M % i == 0: -        cnt += 1 -        if M // i != i: -            cnt += 1 -print(cnt) + + +def divisor(N): +    ret = [] +    for i in range(1, int(N**0.5) + 1): +        if N % i == 0: +            ret.append(i) +            if N // i != i: +                ret.append(N // i) +    return ret + + +div_N = divisor(N) +div_N_1 = divisor(N - 1) +ans = 0 +for k in div_N[1:]: +    n = N +    while n % k == 0: +        n //= k +    if n % k == 1: +        ans += 1 +ans += len(div_N_1) - 1 +print(ans)