import java.util.Scanner;
public class partice33 {
static int num = 0;
static int N = 0;
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
N = reader.nextInt();
int[] arr = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
permutation(arr, 0, arr.length);
System.out.println(num);
}
public static void check(int[] arr) {
for (int i = 1; i < arr.length; i++) {
for (int x = i; x < arr.length; x++) {
int n = 0;
int m = 0;
int a = 0;
for (int s = 0; s < i; s++) {
a = arr[s] + a * 10;
}
for (int s = i; s < x; s++) {
n = arr[s] + n * 10;
}
if (n == 0)
continue;
for (int s = x; s < arr.length; s++) {
m = arr[s] + m * 10;
}
if (m == 0)
continue;
if (n % m == 0) {
if (n / m + a == N)
num++;
}
}
}
}
public static void permutation(int[] arr, int p, int q) {
if (p == q) {
check(arr);
return;
}
for (int i = p; i < q; i++) {
swap(arr, p, i);
permutation(arr, p + 1, q);
swap(arr, p, i);
}
}
public static void swap(int[] arr, int n, int m) {
int temp = arr[n];
arr[n] = arr[m];
arr[m] = temp;
}
}
------------------------------------------------------------------------------------------------------
import java.util.Scanner;
public class Main{
static int num = 0;
static int N = 0;
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
N = reader.nextInt();
int[] arr = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
permutation(arr, 0, arr.length);
System.out.println(num);
}
public static void check(int[] arr) {
for (int i = 1; i < arr.length; i++) {
for (int x = i; x < arr.length; x++) {
int n = 0;
int m = 0;
int a = 0;
for (int s = 0; s < i; s++) {
a = arr[s] + a * 10;
}
for (int s = i; s < x; s++) {
n = arr[s] + n * 10;
}
if (n == 0)
continue;
for (int s = x; s < arr.length; s++) {
m = arr[s] + m * 10;
}
if (m == 0)
continue;
if (n % m == 0) {
if (n / m + a == N)
num++;
}
}
}
}
public static void permutation(int[] arr, int p, int q) {
if (p == q) {
check(arr);
return;
}
for (int i = p; i < q; i++) {
swap(arr, p, i);
permutation(arr, p + 1, q);
swap(arr, p, i);
}
}
public static void swap(int[] arr, int n, int m) {
int temp = arr[n];
arr[n] = arr[m];
arr[m] = temp;
}
}