#include <bits/stdc++.h>
using namespace std;
const int N = 1000000 + 10;
int tot;
vector<int> primes;
int notP[N];
vector<long long> divisors[N];
map<pair<long long, int>, int> dp;
int isP(long long x) {
  for (int i = 0; (long long)primes[i] * primes[i] <= x; ++i) {
    if (x % primes[i] == 0) return false;
  }
  return true;
}
int dfs(long long x, int cur) {
  if (dp.count(make_pair(x, cur))) {
    return dp[make_pair(x, cur)];
  }
  int &ret = dp[make_pair(x, cur)];
  if (cur == tot) {
    if (x == 1) {
      ret++;
    } else if (x > N) {
      ret += isP(x - 1);
    }
    return ret;
  }
  ret += dfs(x, cur + 1);
  for (int i = 0; i < divisors[cur].size(); ++i) {
    if (x % divisors[cur][i] == 0) {
      ret += dfs(x / divisors[cur][i], cur + 1);
    }
  }
  return ret;
}
void solve() {
  long long n;
  cin >> n;
  tot = 0;
  for (int i = 0; i < primes.size(); ++i) {
    int prime = primes[i];
    int flag = false;
    for (long long tmp = prime; tmp < n; tmp *= prime) {
      if (n % (tmp + 1) == 0) {
        if (!flag) {
          flag = true;
          ++tot;
        }
        divisors[tot - 1].push_back(tmp + 1);
      }
    }
  }
  cout << dfs(n, 0) << endl;
}
int main() {
  for (int i = 2; i < N; ++i) {
    if (notP[i]) continue;
    primes.push_back(i);
    for (long long j = (long long)i * i; j < N; j += i) {
      notP[j] = true;
    }
  }
  solve();
  return 0;
}
