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
#include <bits/stdc++.h>
#define FOR(i, a, b)	for (int (i)=(a); (i)<(b); (i)++)
#define PPC(x)			__builtin_popcountll((x))
#define ALL(x)			(x).begin(), (x).end()
#define pb				push_back
using namespace std;

const int maxQ = 33000;

bool isprime[maxQ];
vector <int> primes;

int f(int n)
{
	int res = 1;
	for (int i=0; primes[i] <= n; i++)
	{
		int c = 0;
		while (n % primes[i] == 0)
			n /= primes[i], c++;
		res *= c+1;
	}
	if (n != 1)
		res *= 2;
	return res;
}

int solve(int x)
{
	if (x < 3)
		return 0;
	int res = f(x) - 2;
	if (x % 2 == 0)
		res--;
	return res;
}

int main()
{
	fill(isprime + 2, isprime + maxQ, true);
	for (int i=2; i*i<maxQ; i++)
	{
		if (!isprime[i])
			continue;
		for (int j=i*i; j<maxQ; j+=i)
			isprime[j] = false;
	}
	
	FOR(i, 0, maxQ)
		if (isprime[i])
			primes.pb(i);
	primes.pb(maxQ * maxQ);
	
	int n;
	scanf ("%d", &n);
	long long res = 0;
	
	for (int i=1; i*i<=n; i++)
	{
		if (n % i != 0)
			continue;
		res += solve(n/i - 1);
		if (i * i != n)
			res += solve(i - 1);
	}
	printf("%lld\n", res);
	return 0;
}