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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>>

using namespace std;

std::vector<int> getAllDivisors(int n)
{
	const int upper = sqrt(n);
	std::vector<int> divisors;
	divisors.reserve(30);

	for (int i = 1; i <= upper; i++)
	{
		if (n % i == 0)
		{
			divisors.push_back(i);
			if (n / i != i)
			{
				divisors.push_back(n / i);
			}
		}
	}

	return divisors;
}

int countDivisorsInRange(int n, int from, int to)
{
	const int upper = sqrt(n);
	int count = 0;

	for (int i = 1; i <= upper; i++)
	{
		if (n%i == 0)
		{
			if (from <= i && i <= to)
			{
				++count;
			}

			const int propablyDivisor = n / i;
			if (from <= propablyDivisor && propablyDivisor <= to && propablyDivisor != i)
			{
				++count;
			}
		}
	}

	return count;
}

int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;

	int result = 0;
	std::vector<int> nDivisors = getAllDivisors(n);

	for (auto nDivisor : nDivisors)
	{
		int reminder = (n / nDivisor) - 1;
		result += countDivisorsInRange(reminder, 2, reminder / 3);
	}

	cout << result << endl;
}