#include <bits/stdc++.h>
using namespace std;
long long mulmod(long long a, long long n, long long mod) {
  long long result = 0;
  while (n) {
    if (n & 1) result = (result + a) % mod;
    a = (a + a) % mod;
    n >>= 1;
  }
  return result;
}
long long power(long long a, long long n, long long mod) {
  long long power = a;
  long long result = 1;
  while (n) {
    if (n & 1) result = mulmod(result, power, mod);
    power = mulmod(power, power, mod);
    n >>= 1;
  }
  return result;
}
bool witness(long long n, long long s, long long d, long long a) {
  long long x = power(a, d, n);
  long long y;
  while (s) {
    y = mulmod(x, x, n);
    if (y == 1 && x != 1 && x != n - 1) return false;
    x = y;
    --s;
  }
  if (y != 1) return false;
  return true;
}
bool is_prime_mr(long long n) {
  if (((!(n & 1)) && n != 2) || (n < 2) || (n % 3 == 0 && n != 3)) return false;
  if (n <= 3) return true;
  long long d = n / 2;
  long long s = 1;
  while (!(d & 1)) {
    d /= 2;
    ++s;
  }
  if (n < 1373653) return witness(n, s, d, 2) && witness(n, s, d, 3);
  if (n < 9080191) return witness(n, s, d, 31) && witness(n, s, d, 73);
  if (n < 4759123141)
    return witness(n, s, d, 2) && witness(n, s, d, 7) && witness(n, s, d, 61);
  if (n < 1122004669633)
    return witness(n, s, d, 2) && witness(n, s, d, 13) &&
           witness(n, s, d, 23) && witness(n, s, d, 1662803);
  if (n < 2152302898747)
    return witness(n, s, d, 2) && witness(n, s, d, 3) && witness(n, s, d, 5) &&
           witness(n, s, d, 7) && witness(n, s, d, 11);
  if (n < 3474749660383)
    return witness(n, s, d, 2) && witness(n, s, d, 3) && witness(n, s, d, 5) &&
           witness(n, s, d, 7) && witness(n, s, d, 11) && witness(n, s, d, 13);
  return witness(n, s, d, 2) && witness(n, s, d, 3) && witness(n, s, d, 5) &&
         witness(n, s, d, 7) && witness(n, s, d, 11) && witness(n, s, d, 13) &&
         witness(n, s, d, 17);
}
vector<long long> f;
vector<long long> res;
long long a;
void go(vector<long long> p) {
  for (int i = int(f.size()) - 1; i >= 0; i--) {
    long long v = f[i];
    for (long long x : p)
      if (v % x == 0) {
        long long nv = v / x;
        res[i] += res[lower_bound(f.begin(), f.end(), nv) - f.begin()];
      }
  }
}
int main() {
  scanf("%lld", &a);
  for (long long v = 1; v * v <= a; v++)
    if (a % v == 0) {
      f.push_back(v);
      if (v * v != a) f.push_back(a / v);
    }
  sort(f.begin(), f.end());
  res.resize(int(f.size()));
  res[0] = 1;
  map<long long, vector<long long> > m;
  for (long long v : f) {
    if (v == 1) continue;
    v--;
    for (int k = 1; (1ll << k) <= v; k++) {
      long long val = pow(v, 1. / k);
      if (k == 1)
        val = v;
      else {
        while (pow(val, k) >= 1e15 || power(val, k, 1ll << 62) >= v) val--;
        for (val = max(val - 5, 0ll);
             pow(val, k) < 1e15 && power(val, k, 1ll << 62) < v; val++)
          ;
      }
      if (pow(val, k) < 1e15 && power(val, k, 1ll << 62) == v &&
          is_prime_mr(val)) {
        m[val].push_back(v + 1);
      }
    }
  }
  for (auto p : m) {
    go(p.second);
  }
  printf("%lld\n", res.back());
}
