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
120
121
122
123
124
125
126
#include <cstdio>
#include <vector>

using namespace std;

vector<int> P;

vector<int> get_factors(int N)
{
vector<int> D,R,r,t;
vector<int>::iterator Pi,Pi2;
int i = 1,n = N,v;

	D.push_back(1);
	for (i = 1; i < P.size(); i++) D.push_back(0);

	i = 1;
	while (n > 1 && i < P.size())
	{
		if ((n % P[i]) == 0)
		{
			D[i]++;
			n /= P[i];
		}
		else i++;
	}
	if (n > 1)
	{
//		printf("%d\n",n);
		P.push_back(n);
		D.push_back(1);
	}
	
	R.clear();
	R.push_back(1);
	for (i = 1; i < P.size(); i++)
	{
		if (D[i] > 0)
		{
//			printf("new iter %d\n",P[i]);
			r.clear();
			for (n = 0; n < R.size(); n++)
			{
				v = 1;
				r.push_back(R[n]);
//				printf("1*Rn = %d\n",R[n]);
				
				for (int m = 0; m < D[i]; m++)
				{
					v *= P[i];
					r.push_back(R[n] * v);
//				printf("v^k*Rn = %d * %d\n",v,R[n]);
				}
			}
			R.clear();
			R = r;
//			printf("end of iter %d\n",R.size());
		}
//		printf("%d\n",R.size());
	}
	
	return R;
}

int main()
{
vector<int> D,d;
int tmp = 3,N,n,ret = 0,a,p,q;
vector<int>::iterator Pi,di;

	P.push_back(1);
	P.push_back(2);

//	printf("{");
	while (tmp < 32000)
	{
		Pi = P.begin();
		++Pi;
		while (Pi != P.end() && (tmp % (*Pi) > 0)) ++Pi;
		if (Pi == P.end()) 
		{
			P.push_back(tmp);		
//			printf("%d,",tmp);
		}
		tmp += 2;
	}
//	printf("};");

//	return 0;
	
	scanf("%d",&N);
	n = N;

	D = get_factors(N);
/*
	for (int i = 0; i < D.size(); i++)
	{
		printf("%d\n",D[i]);
	}
	printf("\n");

	return 0;
*/
	
	for (Pi = D.begin(); Pi != D.end(); ++Pi)
	{
		a = *Pi;
		d = get_factors(n/a-1);
		for (di = d.begin(); di != d.end(); ++di)
		{
			p = *di;
			if (p > 1)
			{
				q = (n/a-1)/p-1;
				if (q > 1)
				{
//					printf("Debug: %d %d %d\n",a,a*p,a*p*q);
					ret++;
				}
			}
		}
	}
	printf("%d\n",ret);
	
	return 0;
}