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
#include <iostream>
#include <vector>
using namespace std;

vector<int> divisors(int n) {
    vector<int> ans;
    int i = 1;
    for(; i*i < n; i++)
        if(n % i == 0) {
            ans.push_back(i);
            ans.push_back(n/i);
        }

    if(i*i == n) 
        ans.push_back(i);

    return ans;
}

int main() {
    int n;
    int ans = 0;
    cin >> n;

    auto av = divisors(n);

    for(auto a : av) {
        if(a != 1) {
            auto bv = divisors(a-1);
            for(auto b : bv) {
                if(b > 2 && b != a-1)
                    ans++;
            }
        }
    }
    cout << ans;
}