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

using namespace std;

const int N = 40000;

bool notPrime[N];
vector<int> primes;

int divisorsNo(int w) {
    int ret = 1;
    for (int prime : primes) {
        if (w < prime) {
            break;
        }
        int cnt = 0;
        while (w % prime == 0) {
            w /= prime;
            cnt++;
        }
        ret *= (cnt + 1);
    }
    if (w > 1) {
        ret *= 2;
    }
    return ret;
}

int compForGivenA(int a, int n) {
    int d = n / a - 1;
    if (d <= 1) return 0;
    if (d == 2) return 0;
    return divisorsNo(d) - 2 - (d % 2 == 0);
}

void sieve(int w) {
    for (int i = 2; i * i <= w; i++) {
        if (!notPrime[i]) {
            primes.push_back(i);
            for (int j = 2 * i; (long long)j * j <= w; j += i) {
                notPrime[j] = true;
            }
        }
    }
}

int main() {
    
    int n;
    scanf("%d", &n);
    if (n <= 5) {
        printf("0\n");
        return 0;
    }
    
    sieve(n);
    
    long long ans = 0;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ans += compForGivenA(i, n);
            if (i != n / i) {
                ans += compForGivenA(n / i, n);
            }
        }
    }
    
    printf("%lld\n", ans);
    
    return 0;
}