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

using namespace std;

int count(long long n){
    if(n < 10){
        return (int)(n + 1);
    }
    int counter = (n % 10 + 1) * count(n / 10);
    if(n >= 10 && n % 100 < 20)
        counter += (9 - n % 10) * count(n / 100);
    return counter;
}

int main()
{
    long long n;
    cin >> n;
    cout << count(n) << endl;
    return 0;
}