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

using ll = long long;

int count(int n) {
    int ret = 0;
    for(ll a=2;a*a<=n;++a) {
        if(n%a) continue;
        if(n > 2*a) ++ret;
        if(a*a != n && a > 2) ++ret;
    }
    return ret;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin>>n;
    ll ans = 0;
    for(ll x=1;x*x <= n; ++x) {
        if(n%x) continue;
        ans += count(n/x - 1);
        if(x*x != n && x != 1)
            ans += count(x - 1);
    }
    cout << ans << endl;
}