#include <bits/stdc++.h>
using namespace std;
const int maxN = 1 << 22;
int isp[maxN];
int isPrime(long long a) {
  if (a <= 1) {
    return 0;
  }
  for (long long i = 2; i * i <= a; i++) {
    if (a % i == 0) {
      return 0;
    }
  }
  return 1;
}
set<long long> pr;
int main() {
  long long a;
  cin >> a;
  for (int i = 2; i < maxN; i++) {
    isp[i] = 1;
  }
  for (int i = 1; i < maxN; i++) {
    if (a % i == 0) {
      long long cand = a / i - 1;
      if (cand >= maxN && isPrime(cand)) {
        pr.insert(cand);
      }
    }
    if (isp[i]) {
      for (int j = i * 2; j < maxN; j += i) {
        isp[j] = 0;
      }
      long long b = i;
      while (b + 1 <= a) {
        if (a % (b + 1) == 0) pr.insert(i);
        b *= i;
      }
    }
  }
  vector<long long> pr2;
  for (auto x : pr) {
    pr2.push_back(x);
  }
  unordered_map<long long, int> dp[2];
  dp[0][a] = 1;
  for (int i = 0; i < pr.size(); i++) {
    int f = i & 1;
    dp[f ^ 1] = dp[f];
    for (auto x : dp[f]) {
      long long p = pr2[i];
      long long b = p;
      long long a = x.first;
      while (b < a) {
        if (a % (b + 1) == 0) {
          dp[f ^ 1][a / (b + 1)] += x.second;
        }
        b = max(p, (long long)min(1e13, b * (double)p));
      }
    }
  }
  cout << dp[pr2.size() % 2][1] << endl;
  return 0;
}
