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 <bits/stdc++.h>
using namespace std;

template<class Function>
void for_each_div(int n, Function&& f) {
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      f(i);
      if (i * i != n) {
        f(n / i);
      }
    }
  }
}

int solve1(int n) {
  n--;
  int res = 0;
  auto f = [&res, n](int d) {
    int r = n - d;
    res += r > d && r % d == 0;
  };
  for_each_div(n, std::move(f));
  return res;
}

int solve(int n) {
  int res = solve1(n);
  for_each_div(n, [&res](int d) { res += solve1(d); });
  return res;
}

int main() {
  int n;
  scanf("%d", &n);
  printf("%d\n", solve(n));
  return 0;
}