#include <bits/stdc++.h>
using namespace std;
int main() {
  long long A;
  scanf("%I64d", &A);
  if (A == 1) {
    printf("1\n");
    return 0;
  }
  vector<long long> ls_div;
  for (long long d = 1; d * d <= A; d++)
    if (A % d == 0) {
      ls_div.push_back(d);
      if (d * d != A) ls_div.push_back(A / d);
    }
  sort(ls_div.begin(), ls_div.end());
  map<long long, vector<long long> > m;
  map<long long, int> m2;
  for (int i = 0; i < (int)ls_div.size(); i++) {
    m2[ls_div[i]] = i;
    long long act = ls_div[i] - 1;
    bool is_prime = true;
    for (long long j = 2; j * j <= act; j++)
      if (act % j == 0) {
        is_prime = false;
        while (act % j == 0) act /= j;
        if (act == 1) m[j].push_back(ls_div[i]);
        break;
      }
    if ((act != 1) && is_prime) m[ls_div[i] - 1].push_back(ls_div[i]);
  }
  if (m.empty() || ls_div.empty()) {
    printf("0\n");
    return 0;
  }
  vector<vector<long long> > memo(m.size(),
                                  vector<long long>(ls_div.size(), 0));
  for (int i = 0; i < (int)m.size(); i++) memo[i][0] = 1;
  for (int i = 1; i < (int)ls_div.size(); i++) {
    int j = 0;
    for (map<long long, vector<long long> >::iterator it = m.begin();
         it != m.end(); it++) {
      vector<long long> &ls_pow = it->second;
      if (!j) {
        for (int k = 0; k < (int)ls_pow.size(); k++)
          if (ls_div[i] == ls_pow[k]) {
            memo[j][i] = 1;
            break;
          }
      } else {
        memo[j][i] += memo[j - 1][i];
        for (int k = 0; k < (int)ls_pow.size(); k++)
          if (ls_div[i] % ls_pow[k] == 0)
            memo[j][i] += memo[j - 1][m2[ls_div[i] / ls_pow[k]]];
      }
      j++;
    }
  }
  printf("%I64d\n", memo[m.size() - 1][ls_div.size() - 1]);
  return 0;
}
