#include <bits/stdc++.h>
using namespace std;
vector<long long> f, a, b, c;
vector<long long> v[110000];
long long n, dp[110000], p[110000];
int pcnt = 0, cnt;
bool prime(int n) {
  int i;
  if ((n != 2 && !(n % 2)) || (n != 3 && !(n % 3)) || (n != 5 && !(n % 5)) ||
      (n != 7 && !(n % 7))) {
    return false;
  }
  for (i = 0; p[i] * p[i] <= n; i++) {
    if (!(n % p[i])) {
      return false;
    }
  }
  return n > 1;
}
void initPrime() {
  p[pcnt++] = 2;
  for (int i = 3; i < 1001000; i += 2) {
    if (prime(i)) {
      p[pcnt++] = i;
    }
  }
}
long long check(long long k) {
  if (k < 2) return 0;
  for (int i = 0; p[i] * p[i] <= k; i++)
    if (!(k % p[i])) {
      while (!(k % p[i])) k /= p[i];
      return k == 1 ? p[i] : 0;
    }
  return k;
}
void insert(long long k) {
  f.push_back(k);
  long long t = check(k - 1);
  if (t) {
    a.push_back(t);
    b.push_back(t);
    c.push_back(k);
  }
}
int main() {
  initPrime();
  {
    a.clear();
    b.clear();
    c.clear();
    f.clear();
    cnt = 0;
    scanf("%lld", &n);
    for (long long i = 1; i * i <= n; i++)
      if (!(n % i)) {
        insert(i);
        if (i * i != n) insert(n / i);
      }
    sort(f.begin(), f.end());
    sort(a.begin(), a.end());
    auto pt = unique(a.begin(), a.end());
    a.erase(pt, a.end());
    cnt = a.size();
    int tmp = b.size();
    for (int i = 0; i < tmp; i++) {
      long long j = c[i];
      v[lower_bound(a.begin(), a.end(), b[i]) - a.begin()].push_back(j);
    }
    int l = f.size();
    for (int i = 0; i < l + 1; i++) dp[l] = 0;
    dp[0] = 1;
    for (int i = 0; i < cnt; i++)
      for (int j = l - 1; j >= 0; j--)
        for (auto k : v[i])
          if (!(f[j] % k))
            dp[j] += dp[lower_bound(f.begin(), f.end(), f[j] / k) - f.begin()];
    printf("%lld\n", dp[l - 1]);
  }
}
