#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

char s[10], dict[100][15], aux;
int k;

bool gaseste(char* s) {
    for(int i = 0; i < k; i++)
        if(strcmp(dict[i], s) == 0)
            return false;
    strcpy(dict[k++], s);
    return true;
}

int main()
{
    //freopen("2.in", "r", stdin);
    //freopen("2.out", "w", stdout);
    scanf("%s", s);
    strcpy(s, s+1);
    int n = strlen(s);
    s[0] = '0';
    for(int i = 0; i < n; i++) { // parcurgere pozitie pe care pun cifra
        for(int j = '0'; j <= '9'; j++) {
            aux = s[i];
            s[i] = j;
            gaseste(s);
            s[i] = aux;
        }
        s[i] = '0';
        swap(s[i], s[i+1]);
    }
    printf("%d\n", k);
    return 0;
}