#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-9;
const int MAXP = 1e6 + 10;
bool pr[MAXP];
vector<int> primes;
long long a;
vector<long long> p;
long long get_p(long long val) {
  if (val == 1) return -1;
  long long VAL = val;
  for (int i = 0;
       i < ((int)(primes).size()) && primes[i] * 1ll * primes[i] <= VAL; ++i) {
    if (val % primes[i] == 0) {
      long long pp = primes[i];
      val /= pp;
      while (val % pp == 0) {
        val /= pp;
      }
      if (val == 1) {
        return pp;
      }
      return -1;
    }
  }
  return val;
}
vector<long long> dels;
int get_id_del(long long d) {
  int pos = lower_bound(begin(dels), end(dels), d) - dels.begin();
  if (pos < ((int)(dels).size()) && dels[pos] == d) {
    return pos;
  }
  return -1;
}
vector<pair<long long, long long>> good_dels;
int start[10000];
long long calc(vector<vector<long long>>& dp, int id_del, int id_p) {
  long long& d = dp[id_del][id_p];
  if (d != -1) {
    return d;
  }
  if (id_p == 0) {
    return (d = id_del == 0);
  }
  long long val = dels[id_del];
  d = 0;
  for (int i = start[id_p];
       i < ((int)(good_dels).size()) && good_dels[i].first == id_p; ++i) {
    long long cur_d = good_dels[i].second;
    if (val % cur_d != 0) {
      continue;
    }
    int nid_del = get_id_del(val / cur_d);
    if (nid_del != -1) {
      d += calc(dp, nid_del, id_p - 1);
    }
  }
  d += calc(dp, id_del, id_p - 1);
  return d;
}
int main() {
  memset(pr, true, sizeof pr);
  for (int i = 2; i < MAXP; ++i) {
    if (pr[i]) {
      primes.push_back(i);
      for (int j = i + i; j < MAXP; j += i) {
        pr[j] = false;
      }
    }
  }
  cin >> a;
  for (long long i = 1; i * i <= a; ++i) {
    if (a % i == 0) {
      dels.push_back(i);
      if (i * i < a) {
        dels.push_back(a / i);
      }
    }
  }
  sort(begin(dels), end(dels));
  for (long long del : dels) {
    if (del == 1) continue;
    long long cur_p = get_p(del - 1);
    if (cur_p > 0) {
      good_dels.push_back(make_pair(cur_p, del));
      p.push_back(cur_p);
    }
  }
  p.push_back(-1ll);
  sort(begin(p), end(p));
  p.resize(unique(begin(p), end(p)) - p.begin());
  for (int i = 0; i < (int)((int)(good_dels).size()); ++i) {
    good_dels[i].first =
        lower_bound(begin(p), end(p), good_dels[i].first) - p.begin();
  }
  sort(begin(good_dels), end(good_dels));
  for (int i = 0; i < (int)((int)(good_dels).size()); ++i) {
    if (i == 0 || good_dels[i].first != good_dels[i - 1].first) {
      start[good_dels[i].first] = i;
    }
  }
  vector<vector<long long>> dp(((int)(dels).size()),
                               vector<long long>(((int)(p).size()), -1));
  cout << calc(dp, ((int)(dels).size()) - 1, ((int)(p).size()) - 1) << endl;
  return 0;
}
