#include <bits/stdc++.h>
using namespace std;
long long A;
vector<pair<long long, int> > ls;
vector<long long> M2[100000];
vector<long long> ls2;
long long my_stp(long long first, int stp) {
  if (stp == 0) {
    return 1ll;
  }
  long long res = my_stp(first, stp / 2);
  res = res * res;
  if (stp & 1) {
    res = res * first;
  }
  return res;
}
inline pair<bool, long long> sqrtn(long long first, int stp) {
  long long t = (long long)pow((long double)first, (long double)1 / stp);
  for (long long k = max(2ll, t - 1); k <= t + 1; k++) {
    if (my_stp(k, stp) == first) {
      return make_pair(true, k);
    }
  }
  return make_pair(false, 0ll);
}
inline bool is_prime(long long first) {
  for (long long i = 2; i * i <= first; i++) {
    if (first % i == 0) return false;
  }
  return true;
}
void obr(long long term, int id) {
  for (int i = 1; (1ll << i) <= term - 1; i++) {
    pair<bool, long long> sq = sqrtn(term - 1, i);
    if (sq.first && is_prime(sq.second)) {
      ls2.push_back(sq.second);
      M2[id].push_back(sq.second);
      break;
    }
  }
}
vector<long long> ls3;
void bct(int k, long long mul, int id) {
  if (k == (int)(ls).size()) {
    obr(mul, id);
    ls3[id] = mul;
    return;
  }
  for (int j = 0; j <= ls[k].second; j++) {
    bct(k + 1, mul, id * (ls[k].second + 1) + j);
    mul *= ls[k].first;
  }
}
vector<pair<int, int> > G[100000];
void bct2(int k, int mul1, int mul2) {
  if (k == (int)(ls).size()) {
    if (mul2 != mul1) G[mul1].push_back(make_pair(mul2 - mul1, mul2));
    return;
  }
  for (int j = 0; j <= ls[k].second; j++) {
    for (int j1 = j; j1 <= ls[k].second; j1++) {
      bct2(k + 1, mul1 * (ls[k].second + 1) + j,
           mul2 * (ls[k].second + 1) + j1);
    }
  }
}
int main() {
  cin >> A;
  long long cur = A;
  for (long long i = 2; i * i <= cur; i++) {
    int cnt = 0;
    while (cur % i == 0) {
      cnt++;
      cur /= i;
    }
    if (cnt) {
      ls.push_back(make_pair(i, cnt));
    }
  }
  if (cur > 1) {
    ls.push_back(make_pair(cur, 1));
  }
  int szls3 = 1;
  for (auto first : ls) {
    szls3 *= (first.second + 1);
  }
  ls3.resize(szls3);
  bct(0, (long long)1, 0);
  {
    sort((ls2).begin(), (ls2).end()),
        ls2.resize(unique((ls2).begin(), (ls2).end()) - ls2.begin());
  };
  bct2(0, 0, 0);
  vector<vector<int> > DP((int)(ls3).size(),
                          vector<int>((int)(ls2).size() + 1, 0));
  DP[0][0] = 1;
  for (int first = 0; first < (int)(ls3).size(); first++) {
    for (auto& second : M2[first]) {
      second = lower_bound((ls2).begin(), (ls2).end(), second) - ls2.begin();
    }
  }
  for (int i = 0; i < (int)(ls3).size(); i++) {
    for (int j = 0; j < (int)(ls2).size(); j++) {
      DP[i][j + 1] += DP[i][j];
    }
    for (auto first : G[i]) {
      for (int second : M2[first.first]) {
        DP[first.second][second + 1] += DP[i][second];
      }
    }
  }
  cout << DP[(int)(ls3).size() - 1][(int)(ls2).size()] << endl;
  return 0;
}
