#include <bits/stdc++.h>
using namespace std;
template <int m>
class Prime {
  std::vector<bool> p;
  std::vector<int> ps;

 public:
  Prime() {
    p = std::vector<bool>(m, true);
    assert(m > 1);
    p[0] = p[1] = false;
    for (int i = 4; i < m; i += 2) p[i] = false;
    ps.push_back(2);
    for (int i = 3; i < m; i += 2) {
      if (p[i]) {
        ps.push_back(i);
        for (int j = i + i; j < m; j += i) p[j] = false;
      }
    }
  }
  bool isPrime(int n) {
    assert(m > n);
    return p[n];
  }
  int operator[](int n) {
    if (n < ps.size())
      return ps[n];
    else
      return 0;
  }
  int size() { return ps.size(); }
};
int main() {
  Prime<1000000> p;
  long long a;
  cin >> a;
  vector<vector<long long> > v;
  for (int i = 0; i < (int)(p.size()); i++) {
    long long pp = p[i];
    vector<long long> t;
    while (true) {
      if (a % (pp + 1) == 0) t.push_back(pp + 1);
      if (pp > (a - 1) / p[i]) break;
      pp *= p[i];
    }
    if (t.size()) v.push_back(t);
  }
  if (v.empty() && a != 1) {
    puts("0");
  } else {
    map<long long, int> dp;
    dp[a] = 1;
    for (int i = 0; i < (int)(v.size()); i++) {
      for (auto it = dp.begin(); it != dp.end(); ++it) {
        for (int j = 0; j < (int)(v[i].size()); j++) {
          const long long vv = v[i][j];
          if (it->first % vv == 0) {
            dp[it->first / vv] += it->second;
          }
        }
      }
    }
    int ans = dp[1];
    for (auto it = dp.begin(); it != dp.end(); ++it) {
      const long long aa = it->first;
      if (aa > 1000000) {
        bool f = true;
        for (int i = 0; i < (int)(p.size()); i++)
          if ((aa - 1) % p[i] == 0) {
            f = false;
            break;
          }
        if (f) ans += it->second;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
