#include <bits/stdc++.h>
int p, i, j, primes[78777];
int isPrime(long long x) {
  for (j = 0;; j++) {
    long long y = primes[j];
    if ((y * y) > x) return 1;
    if (!(x % y)) return 0;
  }
}
inline int F(int i, long long a) {
  if (a == 1) return 1;
  long long x = 1, y = primes[i];
  if ((y + 1) > a) return 0;
  if (((y * y) + 1) > a) return isPrime(--a);
  int res = F(++i, a);
  for (;;) {
    x *= y;
    if ((x + 1) > a) break;
    if (!(a % (x + 1))) res = res + F(i, a / (x + 1));
  }
  return res;
}
int Solve(long long a) {
  if (a < 5) return (a != 2);
  return F(0, a);
}
int main() {
  primes[p++] = 2;
  for (i = 3; i < 1000010; i += 2) {
    if (isPrime(i)) primes[p++] = i;
  }
  long long a;
  while (scanf("%I64d", &a) != EOF) printf("%d\n", Solve(a));
}
