import java.util.Scanner;
/**
* @author zhang kun
* @Classname code_1
* @Description TODO
* @Date 2020/12/4 20:24
*/
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
int count = 0;
for(int j = 1; j <= N;j++){
int sum = 0;
int i = j;
while(i!=0){
if(sum >9){
break;
}
sum += i%10;
i = i/10;
}
if(sum == 9){
count++;
}
}
System.out.println(count);
}
}