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
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#include <iostream>
#include <vector>
#include <math.h>

using namespace std;

class Program
{
private:
    int n;  // input sum of three numbers
    int result;  // result


    vector<int> *a_vector;
    vector<int> *x_vector;


    bool CheckTrivial()
    {
        if (n < 7)
        {
            result = 0;
            return true;
        }
        if (n == 7)
        {
            result = 1;
            return true;
        }
        return false;
    }
    void FindDivisors()
    {
        int divisor = 1;
        float barier = sqrtf(n);

        while (divisor < barier)
        {
            if (n % divisor == 0)
            {
                a_vector->push_back(divisor);
                a_vector->push_back(n / divisor);
            }
            divisor++;
        }
        if (divisor == barier) a_vector->push_back(divisor);
    }
    void FindXDivisors(unsigned int k)
    {
        if (x_vector != NULL) delete x_vector;
        x_vector = new vector<int>();

        int divisor = 2;
        float barier = sqrtf(k);
        while (divisor < barier)
        {
            if (k % divisor == 0)
            {
                x_vector->push_back(divisor);
                x_vector->push_back(k / divisor);
            }
            divisor++;
        }
        if (divisor == barier) x_vector->push_back(divisor);
    }


public:
    Program()
    {
        // input data
        cin >> n;
        result = 0;

        a_vector = new vector<int>();
        x_vector = NULL;
    }
    ~Program()
    {
        delete a_vector;
        delete x_vector;
    }

    void FindAnswer()
    {
        if (CheckTrivial())
            return;

        // find divisors of n
        FindDivisors();

        for (int i = 0; i < a_vector->size(); i++)
        {
            // fill x_array with first divisors
            FindXDivisors(n / a_vector->at(i) - 1);

            for (int j = 0; j < x_vector->size(); j++)
            {
                if ((n / a_vector->at(i) - 1) / x_vector->at(j) - 1 > 1)
                    result++;
            }
        }

    }
    unsigned int ReturnAnswer()
    {
        return result;
    }
};


int main()
{
    Program P;
    P.FindAnswer();
    cout << P.ReturnAnswer() << endl;

    return 0;
}