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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Dhanin Gupta
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        FDivisionOrSubstraction solver = new FDivisionOrSubstraction();
        solver.solve(1, in, out);
        out.close();
    }

    static class FDivisionOrSubstraction {
        public void solve(int testNumber, InputReader in, PrintWriter w) {
            long n = in.nextLong();
            long m = n;
            long ans = 2;
            HashSet<Long> hs = new HashSet<>();

            if (n == 2) {
                w.println(1);
            } else {
                for (int i = 2; i <= Math.sqrt(n); i++) {
                    m = n;
                    if (n % i == 0) {
                        long x1 = i;
                        long x2 = n / i;

                        if (x1 == x2) {
                            while (m % x1 == 0) {
                                m /= x1;
                            }

                            if (m % x1 == 1) {
                                hs.add(x1);
                                //w.println("ya "+x1);
                            }

                        } else {
                            while (m % x1 == 0) {
                                m /= x1;
                            }

                            if (m % x1 == 1) {
                                hs.add(x1);
                                //w.println("ya "+x1);
                            }


                            m = n;

                            while (m % x2 == 0) {
                                m /= x2;
                            }

                            if (m % x2 == 1) {
                                hs.add(x2);
                                //w.println("ya: "+x2);
                            }

                        }
                    } else {
                        m = n;
                        if (m % i == 1) {
                            hs.add((long) i);
                            hs.add((long) (n / i));
                        }
                    }
                }

                w.println(hs.size() + 2);
            }
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

