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
#include <cstdio>
#include <vector>
#include <cmath>

using namespace std;

vector<int> allDivisors(int n) {
	vector<int> v;
	int sn = sqrt(n);
	for (int i = 1; i <= sn; i++) {
		if (n % i == 0) {
			v.push_back(i);
			if (i * i != n) {
				v.push_back(n / i);
			}
		}
	}
	return v;
}

int getPQs(int n) {
	int pqs = 0;

	int sn = sqrt(n);
	int p, q;
	for (int i = 2; i <= sn; i++) {
		if (n % i == 0) {
			p = i;
			q = n / i - 1;
            if (p >= 2 && q >= 2) ++pqs;

            if (i * i == n) continue;

			p = n / i;
			q = i - 1;
            if (p >= 2 && q >= 2) ++pqs;
		}
	}

	return pqs;
}

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

	vector<int> divisors = allDivisors(n);
	int N = 0;
	for (auto a : divisors) {
		int m = (n - a) / a;
		if (m < 6) continue;
		N += getPQs(m);
	}

	printf("%i\n", N);

	return 0;
}