1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <cstdio>
#include <vector>
using namespace std;

#define PB push_back

typedef vector<int> VI;

VI factors(int k) {
  VI result;

  for (int i=1; i*i<=k; ++i) {
    if (k % i == 0) {
      result.PB(i);
      if (i*i < k) {
        result.PB(k/i);
      }
    }
  }

  return result;
}

int main() {
  int n; scanf("%d", &n);

  int result = 0;
  for (int c : factors(n)) {
    if (c == 0) continue;
    for (int d : factors(c-1)) {
      if (d == c-1) continue;
      if (d < 3) continue;
      result += 1;
    }
  }
  printf("%d\n", result);
  return 0;
}