#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
char buf[1 << 12], *pp1 = buf, *pp2 = buf, nc;
int ny;
inline char gc() {
  return pp1 == pp2 &&
                 (pp2 = (pp1 = buf) + fread(buf, 1, 1 << 12, stdin), pp1 == pp2)
             ? EOF
             : *pp1++;
}
inline long long read() {
  long long x = 0;
  for (ny = 1; nc = gc(), (nc < 48 || nc > 57) && nc != EOF;)
    if (nc == 45) ny = -1;
  if (nc < 0) return nc;
  for (x = nc - 48; nc = gc(), 47 < nc && nc < 58 && nc != EOF;
       x = (x << 3) + (x << 1) + (nc ^ 48))
    ;
  return x * ny;
}
long long A, p[MAXN];
int lim, N, tot;
struct Node {
  long long a[MAXN], b[MAXN];
  inline long long& operator[](long long x) {
    return x <= lim ? a[x] : b[A / x];
  }
} vis, id;
inline int Mysqrt(long long x) {
  int y = sqrt(x);
  for (; 1ll * y * y > x; y--)
    ;
  for (; 1ll * (y + 1) * (y + 1) <= x; y++)
    ;
  return y;
}
int v[MAXN], pri[MAXN], cnt;
long long pp[MAXN];
inline void Init(int n = 1e6) {
  for (int i = (2); i <= (n); i++) {
    if (!v[i]) {
      pri[++cnt] = i;
      for (long long t = 1ll * i * i; t <= A; t *= i)
        if (A % (t + 1) == 0) vis[t + 1] = i;
    }
    for (int j = 1; j <= cnt && i * pri[j] <= n; j++) {
      v[i * pri[j]] = 1;
      if (i % pri[j] == 0) break;
    }
  }
}
inline long long Abs(long long x) { return x < 0 ? -x : x; }
inline long long gcd(long long x, long long y) {
  for (long long z; y; z = x, x = y, y = z % y)
    ;
  return x;
}
inline long long Fm(long long a, long long b, long long Mod) {
  a %= Mod, b %= Mod;
  return (a * b - (unsigned long long)((long double)a / Mod * b) * Mod + Mod) %
         Mod;
}
inline long long Fp(long long x, long long k, long long Mod) {
  long long ans = 1;
  for (; k; k >>= 1, x = Fm(x, x, Mod))
    if (k & 1) ans = Fm(ans, x, Mod);
  return ans;
}
int kx[5] = {2, 3, 5, 7, 43};
inline bool Mr(long long a, long long n) {
  if (Fp(a, n - 1, n) != 1) return 0;
  for (long long y = n - 1, z; !(y & 1);) {
    y >>= 1, z = Fp(a, y, n);
    if (z != 1 && z != n - 1) return 0;
    if (z == n - 1) return 1;
  }
  return 1;
}
inline bool chk(long long n) {
  if (n < 2) return 0;
  if (n == 2 || n == 3 || n == 5 || n == 7 || n == 43) return 1;
  return Mr(2, n) && Mr(3, n) && Mr(5, n) && Mr(7, n) && Mr(43, n);
}
vector<long long> S[MAXN];
long long f[MAXN], g[MAXN];
int main() {
  A = read(), lim = Mysqrt(A);
  for (int i = (1); i <= (lim); i++)
    if (A % i == 0) p[++N] = i, 1ll * i * i != A ? p[++N] = A / i : 0;
  sort(p + 1, p + N + 1);
  for (int i = (1); i <= (N); i++) id[p[i]] = i;
  for (int i = (2); i <= (N); i++)
    if (chk(p[i] - 1)) vis[p[i]] = p[i] - 1;
  Init();
  for (int i = (1); i <= (N); i++)
    if (vis[p[i]]) pp[++tot] = vis[p[i]];
  sort(pp + 1, pp + tot + 1), tot = unique(pp + 1, pp + tot + 1) - pp - 1;
  for (int i = (1); i <= (N); i++)
    if (vis[p[i]]) {
      int t = lower_bound(pp + 1, pp + tot + 1, vis[p[i]]) - pp;
      S[t].push_back(p[i]);
    }
  g[1] = f[1] = 1;
  for (int i = (1); i <= (tot); i++) {
    for (int j = (id[A / S[i][0]]); j >= (1); j--)
      for (auto o : S[i])
        if (o * p[j] > A)
          break;
        else if (A % (o * p[j]) == 0)
          g[id[o * p[j]]] += f[j];
    for (int j = (1); j <= (N); j++) f[j] = g[j];
  }
  cout << f[N] << "\n";
  return 0;
}
