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
/*
 * =====================================================================================
 *
 *       Filename:  pin.cc
 *
 *    Description:  https://sio2.mimuw.edu.pl/c/pa-2018-1/p/pin/
 *
 *        Version:  1.0
 *        Created:  04.12.2018 23:16:32
 *
 *         Author:  Michał Zagórski (zagura), <mzagorsk@student.agh.edu.pl>
 *   Organization:  AGH University of Science and Technology, Kraków
 *
 * =====================================================================================
 */


#include <cstdio>
// x > 1, y > 1 => 1 + y > 2

int main() {
    long n = 0;
    unsigned long result = 0;
    scanf("%ld", &n);
    for (int a = 1; a <= n / 7; a++) {
        if (n % a == 0) {
            int max_mul = n / a - 1;
            for(int x = 2; x * x <= max_mul; x += 1) {
                if (max_mul % x == 0) {
                    int y = max_mul / x - 1;
                    long total = a + (a * x) + (a * x * y);
                    if (y > 1 && total == n) {
                        if (x > 2 && x*x != max_mul) {
                            result += 1;
                        }
                        result += 1;
                        
                    }
                }
            }
        }
    }

    printf("%lu\n", result);
    return 0;
}