#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1000000 + 10;
const long long P[10] = {2, 3, 7, 97, 19260817};
long long n, m, pri[maxn], vis[maxn], tot;
map<long long, long long> f[2], mp;
vector<long long> v[maxn << 1];
set<long long> s;
inline void sieve(long long n) {
  for (long long i = 2; i <= n; i++) {
    if (!vis[i]) pri[++tot] = i;
    for (long long j = 1; j <= tot && i * pri[j] <= n; j++) {
      vis[i * pri[j]] = 1;
      if (i % pri[j] == 0) break;
    }
  }
}
inline long long mul(long long a, long long b, long long mod) {
  long long ret = 0;
  for (; b; b >>= 1, a = (a + a) % mod)
    if (b & 1) ret = (ret + a) % mod;
  return ret;
}
inline long long fpow(long long a, long long b, long long mod) {
  long long ret = 1;
  for (; b; b >>= 1, a = mul(a, a, mod))
    if (b & 1) ret = mul(ret, a, mod);
  return ret;
}
inline bool check(long long x) {
  if (x < 2) return 0;
  for (long long i = 0; i < 5; i++)
    if (x == P[i]) return 1;
  for (long long i = 0; i < 5; i++)
    if (x % P[i] == 0) return 0;
  for (long long i = 0; i < 5; i++)
    if (fpow(P[i] % x, x - 1, x) != 1) return 0;
  return 1;
}
signed main() {
  srand(time(0));
  sieve(maxn - 10);
  scanf("%I64d", &n);
  m = sqrt(n);
  long long val, i = 1, x, y, z, q;
  for (long long i = 1; i <= tot; i++) {
    val = pri[i];
    while (val <= n) mp[val] = i, val *= pri[i];
  }
  for (long long i = 1; i <= m; i++)
    if (n % i == 0) {
      if (mp.count(i - 1)) v[mp[i - 1]].push_back(i), s.insert(mp[i - 1]);
      if (i * i != n) {
        val = n / i;
        if (mp.count(val - 1))
          v[mp[val - 1]].push_back(val), s.insert(mp[val - 1]);
        else if (check(val - 1))
          v[++tot].push_back(val), s.insert(tot);
      }
    }
  f[0][1] = 1;
  set<long long>::iterator it;
  map<long long, long long>::iterator j;
  vector<long long>::iterator k;
  for (it = s.begin(); it != s.end(); it++) {
    x = *it;
    f[i & 1] = f[i & 1 ^ 1];
    for (j = f[i & 1 ^ 1].begin(); j != f[i & 1 ^ 1].end(); j++) {
      y = j->first;
      z = j->second;
      for (k = v[x].begin(); k != v[x].end(); k++) {
        q = *k;
        if (n / q >= y && n % (y * q) == 0) f[i & 1][y * q] += z;
      }
    }
    i++;
  }
  printf("%I64d\n", f[s.size() & 1][n]);
  return 0;
}
