#include <stdio.h>

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

	return 0;
}