#include <iostream>
using namespace std;

int main() {
    int count=0;
    for (int a = 1; a <= 2019; a++) {
        int b=a;
        while (b > 0) {
            if (b % 10 == 9) {count++;break;}
            else b = b / 10;
        }
    }
    cout<<count;
    return 0;
}