1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <cstdio>

using namespace std;

unsigned long long count(unsigned long long n) {
	if (n < 10) {
		return n + 1;
	}

	if (n % 100 > 9 && n % 100 < 19) { 
		return (19 - (n % 100)) * count(n / 100) + count(n % 10) * count(n / 10);
	}

	return count(n % 10) * count(n / 10);
}

int main() {
	unsigned long long n;
	scanf("%llu", &n);
	printf("%llu\n", count(n));
	return 0;
}