#include <stdio.h>

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