#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e6 + 6;
const int mod = (int)1e9 + 7;
vector<pair<int, vector<long long> > > p, val;
long long A;
vector<int> prime;
bool notprime[maxn];
map<pair<long long, int>, int> mp;
bool isprime(long long x) {
  for (int i = 2; 1LL * i * i <= x; i++) {
    if (x % i == 0) return 0;
  }
  return 1;
}
long long F(long long divisor, int _p) {
  if (divisor == 1) return 1;
  if (_p == -1 && divisor != 1) return 0;
  if (mp.count(pair<long long, int>(divisor, _p)))
    return mp[pair<long long, int>(divisor, _p)];
  long long ret = 0;
  ret += F(divisor, _p - 1);
  vector<long long> tmp = val[_p].second;
  for (int i = 0; i < tmp.size(); i++) {
    if (divisor % tmp[i] == 0) ret += F(divisor / tmp[i], _p - 1);
  }
  return mp[pair<long long, int>(divisor, _p)] = ret;
}
int main() {
  cin >> A;
  long long cA = A;
  notprime[1] = 1;
  for (int i = 2; i < maxn; i++) {
    if (notprime[i]) continue;
    prime.push_back(i);
    for (long long j = 1LL * i * i; j < maxn; j += i) {
      notprime[j] = 1;
    }
  }
  for (int i = 0; i < prime.size(); i++) {
    long long pp = 1;
    int cnt = 0;
    vector<long long> k, kval;
    while (pp <= A) {
      cnt++;
      pp *= prime[i];
      if (A % (pp + 1) == 0) {
        k.push_back(cnt);
        kval.push_back(pp + 1);
      }
    }
    if (k.size()) {
      p.push_back(pair<int, vector<long long> >(prime[i], k));
      val.push_back(pair<int, vector<long long> >(prime[i], kval));
    }
  }
  for (long long i = sqrt(A); i >= 1; i--) {
    if (A % i == 0) {
      long long x = A / i;
      if (x >= maxn && isprime(x - 1)) {
        vector<long long> k, kval;
        kval.push_back(x);
        k.push_back(1);
        p.push_back(pair<int, vector<long long> >(x - 1, k));
        val.push_back(pair<int, vector<long long> >(x - 1, kval));
      }
    }
  }
  cout << F(A, p.size() - 1);
}
