#include <bits/stdc++.h>
using namespace std;
long long n;
unordered_map<long long, long long> dp;
unordered_map<long long, set<long long>> st;
vector<pair<long long, long long>> vec;
void check(long long x) {
  if (x <= 2) return;
  x--;
  for (long long i = 2; i * i <= x; i++)
    if (x % i == 0) {
      int cnt = 0;
      long long z = x;
      while (x % i == 0) cnt++, x /= i;
      if (x > 1) return;
      st[i].insert(z);
      return;
    }
  st[x].insert(x);
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> n;
  for (long long i = 1; i * i <= n; i++)
    if (n % i == 0) check(i), check(n / i);
  dp[1] = 1;
  for (auto X : st) {
    vec.clear();
    for (long long x : X.second)
      for (pair<long long, long long> p : dp)
        if (n % (p.first *= (x + 1)) == 0) vec.push_back(p);
    for (pair<long long, long long> p : vec) dp[p.first] += p.second;
  }
  cout << dp[n];
  return 0;
}
