Given is a positive integer N.

We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.

* Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.



In how many choices of K will N become 1 in the end?

Constraints

* 2 \leq N \leq 10^{12}
* N is an integer.

Input

Input is given from Standard Input in the following format:


N


Output

Print the number of choices of K in which N becomes 1 in the end.

Examples

Input

6


Output

3


Input

3141


Output

13


Input

314159265358


Output

9
input = raw_input

n = int(input())

def fctr1(n): 
    f=[]
    c=0
    r=int(n**0.5)
    for i in range(2,r+2):
        while n%i==0:
            c+=1
            n=n//i
        if c!=0:
            f.append([i,c])
            c=0
    if n!=1:
        f.append([n,1])
    return f

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i: # choufuku
                divisors.append(n//i)
    # divisors.sort()
    return divisors


def f(n, k):
    tmp = [n]
    while True:
        q = n % k
        if q == 0:
            n /= k
            tmp.append(n)
        elif q == 1:
            tmp.append(q)
            #print(tmp)
            return True
        else:
            return False

#out = 0
#for k in range(2, n): 
#    flag = f(n, k)
#    if flag:
#        print("ans", n, k)
#        out += 1
#out += 1 # k = n

elms = fctr1(n-1) 
out1 = 1
for a, b in elms:
    out1 *= (b+1)
out1 -= 1

yaku2 = make_divisors(n)
out2 = 0
yaku2.remove(n)
yaku2.remove(1)
for ya1 in yaku2:
    ya2 = n // ya1
    while ya1 % ya2 == 0:
        ya1 //= ya2
    if ya1 % ya2 == 1:
        out2 += 1
out2 += 1 # n

#print(out1, out2)
out = out1 + out2

print(out)