import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int count = 99;
int tempI = 0;
int tempILen = 0;
int temp = 0;
int temp2 = 0;
int diff = 10;
int input = 0 ;
input = sc.nextInt();
if(input < 100) {
System.out.println(input);
return ;
}else {
for (int i = 100 ; i <= input ; i++) {
diff = 10;
tempI = i;
temp = tempI%10;
tempI /= 10;
tempILen = (int)Math.log10(tempI);
for (int j = 0 ; j <= tempILen ; j++) {
temp2 = tempI%10;
tempI /= 10;
if(diff != 10) {
if(diff != temp-temp2) {
count --;
break;
}
}
diff = temp-temp2;
temp = temp2;
}
count ++;
}
}
System.out.println(count);
}
}