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
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <climits>
#include <stack>
#define FOR(i,p,k) for(int i = (p);i<(k);i++)
typedef long long int LL;
using namespace std;

int n;

void dane() {
    cin>>n;
    LL count = 0;
	for(int i = 1; i*i <= n; i++) {
		if(n % i != 0) {
			continue;
		}
		int reszta = n / i - 1;
		int reszta2 = i - 1;
	
		for(int j = 2; j*j <= reszta; j++) {
			if(reszta % j == 0 && reszta / j >= 3) {
				count++;
			}
			if(reszta % j == 0 && j >= 3 && reszta / j != j) {
				count++;
			}
		}
		if(reszta != reszta2)
			for(int j = 2; j*j <= reszta2; j++) {
				if(reszta2 % j == 0 && reszta2 / j >= 3) {
					count++;
				}
				if(reszta2 % j == 0 && j >= 3 && reszta2 / j != j) {
					count++;
				}
			}
	}
	
	cout<<count<<endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    dane();
    return 0;
}