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
#include <cstdio>
#include <set>
#include <algorithm>

void findAllDividers(int n, std::set<int>& dividers) 
{
	int m = n;
	for (int i = 2; i <= m && i * i <= n; ++i) {
		while (m % i == 0) {
			std::set<int> newDividers(dividers.begin(), dividers.end());
			for (auto it = dividers.begin(); it != dividers.end(); ++it) {
				newDividers.insert(i * *it);
			}
			newDividers.insert(i);

			std::swap(dividers, newDividers);
			m /= i;
		}
	}
}

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

	std::set<int> nDividers;
	findAllDividers(n, nDividers);
	nDividers.insert(1);

	for (auto nIt = nDividers.begin(); nIt != nDividers.end() && *nIt <= (n / 7); ++nIt) {
		std::set<int> mDividers;
		int m = n / *nIt - 1;
		findAllDividers(m, mDividers);
		for (auto mIt = mDividers.begin(); mIt != mDividers.end() && *mIt <= (m / 3); ++mIt) {
			result++;
		}
	}

	printf("%d", result);
	return 0;
}