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
39
40
41
42
43
44
#include <iostream>
using namespace std;

namespace {

template <typename F>
void for_all_divisors(int n, F&& f)
{
  for (int d = 1; d <= n / d; ++d) {
    if (n % d == 0) {
      f(d);
      if (n / d != d) f(n / d);
    }
  }
}

int solve(int n)
{
  int res = 0;

  for_all_divisors(n, [&](int a) {
    int z = n / a;
    for_all_divisors(z - 1, [&](int x) {
      int y = z / x - 1;
      if (x > 1 && y > 1) ++res;
    });
  });

  return res;
}

}

int main()
{
  iostream::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;
  cin >> n;
  cout << solve(n) << endl;

  return 0;
}