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
#include <bits/stdc++.h>

using namespace std;

int count(int n) {
	if (n == 0 || n == 1 || n == 2)
		return 0;

	unordered_map <int, int> krotnosci;
	int ans = 1, i, a = 0;
	if(n % 2 == 0) a = -1;
	for (i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			krotnosci[i]++;
			n /= i;
		}
	}
	if (n != 1)
		krotnosci[n]++;
	
	for (auto d : krotnosci) {
		ans *= (d.second + 1);	
	}
	
	return ans - 2 + a;
}

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

	for (int i = 1; i * i <= n; i++) {
		if(n % i == 0) {		
			ans += count(n / i - 1);
			if (n / i != i)
				ans += count(i - 1);
		}
	}
	cout << ans << "\n";
}