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
45
46
47
#include <cstdio>
#include <vector>

std::vector<int> divisors(int n)
// O(sqrt(n)))
{
  std::vector<int> returned_divisors;

  int i = 1;
  while (i * i < n)
  {
    if (n % i == 0)
    {
      returned_divisors.push_back(i);
      returned_divisors.push_back(n/i);
    }
    i++;
  }
  if (i * i == n)
    returned_divisors.push_back(i);
  return returned_divisors;
}

int n{};

int getNumberOfSolutions(int k)
// a * b == k: a >= 2, b >= 3
{
  if (k <= 2)
    return 0;
  if (k % 2 == 0)
    return divisors(k).size() - 3; // subtract: a == 1; b == 1; b == 2
  else
    return divisors(k).size() - 2; // subtract: a == 1; b == 1;
}

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

  int sum{};
  for (int d: divisors(n))
  {
    sum += getNumberOfSolutions(d - 1);
  }
  printf("%d\n", sum);
}