#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 10;
const long long MS = 1e5 + 10;
long long A;
vector<long long> dv, vec[MS];
long long cnt;
unordered_map<long long, long long> dp, Base;
unordered_map<long long, long long> P;
void solve_dp() {
  for (auto D : dv) dp[D] = Base[D] = 0;
  Base[1] = 1;
  for (long long i = 0; i < cnt; ++i) {
    for (auto D : dv) {
      dp[D] = Base[D];
      for (auto x : vec[i]) {
        if (D % x) continue;
        dp[D] += Base[D / x];
      }
    }
    for (auto D : dv) {
      Base[D] = dp[D];
    }
  }
  cout << Base[A] << '\n';
}
int32_t main() {
  ios_base ::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> A;
  for (long long d = 1; 1ll * d * d <= A; ++d) {
    if (A % d == 0) {
      if (d > 2) dv.push_back(d);
      if (A != 1ll * d * d && A / d > 2) dv.push_back(A / d);
    }
  }
  long long My = 0;
  for (auto D : dv) {
    long long T = -1;
    for (long long i = 2; 1ll * i * i <= D - 1; ++i)
      if ((D - 1) % i == 0) {
        T = i;
        break;
      }
    if (T == -1) T = D - 1;
    long long cur = D - 1;
    while (cur % T == 0) cur /= T;
    if (cur == 1) {
      ++My;
      if (P.count(T) == 0) P[T] = cnt++;
      vec[P[T]].push_back(D);
    }
  }
  solve_dp();
  return 0;
}
