#include <bits/stdc++.h>
using namespace std;
vector<int> find_primes(long long upto) {
  vector<int> is_bad(upto + 1);
  vector<int> primes;
  is_bad[0] = is_bad[1] = 1;
  for (long long i = 2; i <= upto; ++i) {
    if (!is_bad[i]) {
      primes.push_back(i);
      for (long long j = i * i; j <= upto; j += i) {
        is_bad[j] = 1;
      }
    }
  }
  return primes;
}
long long find_1_pk_decomposition(long long d, const vector<int>& primes) {
  if (d < 3) return 0;
  long long m = sqrt(d) + 1;
  long long x = d - 1;
  for (auto i : primes) {
    if (i > m) break;
    if (x % i == 0) {
      while (x % i == 0) x /= i;
      if (x == 1) return i;
      return 0;
    }
  }
  return x;
}
void solve() {
  long long A;
  cin >> A;
  const vector<int> primes = find_primes(sqrt(A) + 10);
  vector<long long> factors;
  map<long long, vector<long long> > prime2factors;
  for (long long i = 1; i * i <= A; ++i) {
    if (A % i == 0) {
      factors.push_back(i);
      if (i != A / i) factors.push_back(A / i);
      prime2factors[find_1_pk_decomposition(i, primes)].push_back(i);
      prime2factors[find_1_pk_decomposition(A / i, primes)].push_back(A / i);
    }
  }
  prime2factors.erase(0);
  sort((factors).begin(), (factors).end(),
       [](long long x1, long long x2) { return x1 > x2; });
  vector<vector<long long> > primable_groups;
  for (auto& p : prime2factors) primable_groups.push_back(p.second);
  if (primable_groups.size() == 0) {
    cout << int(A == 1);
    return;
  }
  unordered_map<long long, long long> divider2ans;
  divider2ans[1] = 1;
  for (int(pix) = 0; (pix) < (primable_groups.size()); (pix)++) {
    for (auto divider : factors) {
      if (divider == 1) continue;
      for (long long p1_divider : primable_groups[pix]) {
        if (divider % p1_divider == 0) {
          auto it = divider2ans.find(divider / p1_divider);
          if (it != divider2ans.end()) {
            divider2ans[divider] += it->second;
          }
        }
      }
    }
  }
  cout << divider2ans[A];
}
int main() {
  ios_base::sync_with_stdio(0);
  solve();
  return 0;
}
