import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        int temp;
        int count=0;
        for(int i = 0; i < 2020 ; i++){
            temp = i;
            while(temp>0){
                if(temp % 10 == 9){
                    count++;
                    break;
                }
                temp = temp / 10;
            }
        }
        System.out.println(count);
    }
}