#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>

typedef long long lLong;
typedef unsigned long uLong;
typedef unsigned long long ulLong;
typedef unsigned int uInt;
typedef unsigned char Byte;

using namespace std;

#define FOR(x, b, e) for(int x=b; x<=(e); ++x)
#define ALL(i) (i).begin(), (i).end()
#define CONTAINS(i,v) (find(ALL(i),v)!=(i).end())
typedef vector<bool> bit_vector;
typedef vector<int> int_vector;
typedef vector<uInt> VI;
typedef vector<ulLong> VLL;


#define MAX_N 1000000001

class PrzypadekTestowy
{
private:
	uInt _n, _m;
	FILE *_input;

	inline void Reset()
	{
	}

	inline void WczytajInt(int *value)
	{
		fscanf(_input, "%d", value);
	}

	inline void WczytajlLong(lLong *value)
	{
		fscanf(_input, "%lld", value);
	}

	inline void WczytajParelLong(lLong *value1, lLong *value2)
	{
		fscanf(_input, "%lld %lld\n", value1, value2);
	}

	inline void WczytajPareInt(uInt *value1, uInt *value2)
	{
		fscanf(_input, "%d %d\n", value1, value2);
	}

public:
	PrzypadekTestowy() :_input(stdin)
	{
	}
	PrzypadekTestowy(FILE *input)
	{
		_input = input;
	}

	inline void Wykonaj()
	{
		Reset();
		int n = 0;
		WczytajInt(&n);

		int result = 0;
		// sprawdzamy tylko dzielniki liczby n
		int maxi = sqrt(n) + 1;
		for (int i = 1; i < maxi; i++)
		{
			if (n%i != 0) continue;

			int first = i;
			int second = n / i;
			result += Check(first, n);
			if (first == second) break;
			result += Check(second, n);
		}
		printf("%d", result);
	}
	//funkcja weryfikujaca warunki poprawności wyznaczonych cyfr pinu
	inline int Check2(int i, int j, int n)
	{
		if (j%i != 0 || i==j) return 0;
		int t = n - (i + j);
		if (t <= j || t%j!=0) return 0;
		//printf("%d,%d,%d\n", i, j, t);
		return 1;		
	}

	inline int Check(int i, int n)
	{		
		if (i == n) return 0;
		int newN = n - i;
		//w drugim kroku sprawdzamy tylko dzielniki liczby n-i (dzielnik n)
		int result = 0;
		int maxi = sqrt(newN) + 1;
		for (int x = 1; x < maxi; x++)
		{
			if (newN%x != 0) continue;			
			result += Check2(i, x, n);
			int second = newN / x;									
			if (x == second) break;
			result += Check2(i, second, n);
		}
		return result;
	}	
};

int main(int argc, char **argv)
{
	FILE *in = stdin;
	if (argc>1)
	{
		in = fopen(argv[1], "rt");
		if (NULL == in)
		{
			in = stdin;
		}
	}

	PrzypadekTestowy *p = new PrzypadekTestowy(in);
	p->Wykonaj();
	fclose(in);
	delete(p);
	return 0;
}
