Problem5271--ABC161——Task F:Division or Substraction

5271: ABC161——Task F:Division or Substraction

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

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?

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.

Sample 1 Input

6

Sample 1 Output

3

HINT

【Tips】
There are three choices of K in which N becomes 1 in the end: 2, 5, and 6.
In each of these choices, N will change as follows:
Constraints
2 ≤ N ≤ 1012
N is an integer.
【题目来源】
https://atcoder.jp/contests/abc161/tasks/abc161_f

Source/Category

AtCoder_ABC 100.161.ABC161