import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdlib;

void main() {
    auto N = readln.chomp.to!long;

    long[] F;
    for (long i = 1; i * i <= (N - 1); ++i) {
        if ((N - 1) % i == 0) {
            F ~= i;
            if (i * i != (N - 1)) {
                F ~= (N - 1) / i;
            }
        }
    }
    F.sort();

    long[] G;
    for (long i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            G ~= i;
            if (i * i != N) {
                G ~= N / i;
            }
        }
    }
    G.sort();

    long ans = F.length.to!int - 2;
    foreach (g; G) if ((N / g - 1) % g == 0) ans += 1;


    for (long i = 2; i * i <= N; ++i) {
        for (long x = i * i; x <= N; x *= i) {
            if (N % x != 0) continue;
            long y = N / x - 1;
            if (y % i == 0) ans += 1;
        }
    }

    ans.writeln;
}