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
N = int( input() )
C = 0

def ch(k):
  global C
  if k < 2:
    return
  
  n = N
  while (n >= k) and (n%k == 0):
    n = n // k
  if ( n%k == 1 ):
    C += 1
  return

#　k = 1
ch(N)
ch(N-1)
#
nn = int( N**0.5 )
for k in range(2,nn+1):
  z = N%k
  if z <= 1:
    ch(k)
    k2 = N//k
    if k!=k2:
      ch(k2)
#
print(C)
