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

vector <int> factors(int x) {
    vector <int> result;
    int i = 1;
    while(i*i <= x) {
        if(x % i == 0) {
            result.push_back(i);
            if(x/i != i) {
                result.push_back(x/i);
            }
        }
        i++;
    }
    return result;
}

int main()
{
    unsigned int n,a,x,y,count=0;
    cin>>n;
    vector <int> num = factors(n);
    for(int aa=0;aa<num.size();aa++)
    {
        a = num[aa];
        vector <int> num2 = factors((n/a)-1);
        for(int bb=0;bb<num2.size();bb++)
        {
            x = num2[bb];
            y = ((n-a) / (a*x))-1;
            if( a<(a*x) && ((a*x)<(a*x*y)) && (a+(a*x)+(a*x*y))==n)
            {
                count++;
            }
        }
    }
    cout<<count<<endl;
    return 0;
}