#include <stdio.h>

int main() {
    int i = 0;
    int count = 0;
    for(i = 1;i<=2019;i++)
    {
        int temp = i;
        while(temp)
        {
            if(temp%10==9)
            {
                count++;
                break;
            }
            temp/=10;
        }
    }
    printf("%d",count);
    return 0;
}