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

import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

import java.util.*;

public class Main {
    long MOD = (long) 1e9 + 7;

    InputStream in;
    OutputStream out;

    public Main() {
        this(System.in, System.out);
    }

    public Main(InputStream in, OutputStream out) {
        this.in = in;
        this.out = out;
    }

    void run() {
        Scanner sc = new Scanner(this.in);
        PrintWriter out = new PrintWriter(this.out);

        // write your code
        long n = sc.nextLong();

        long cnt = factors(n - 1).size() - 1;
//        debug(factors(n - 1), cnt);

        HashSet<Long> facts = factors(n);

        for (long i : facts) {
            if (i == 1) continue;
            long t = n;
            while (t % i == 0) t /= i;
//            debug(i, t, t % i);
            if (t % i == 1) cnt++;
        }

        out.println(cnt);

        out.flush();
    }

    HashSet<Long> factors(long n) {
        HashSet<Long> facts = new HashSet<>();
        for (long i = 1; i * i <= n; i++) {
            if (n % i == 0) {
                facts.add(i);
                facts.add(n / i);
            }
        }
        return facts;
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}