#include <stdio.h>
int main()
{
	int i = 1;
	int sum = 0;
	int One = 0, Ten = 0, Hundred = 0;
	for (i = 1; i <= 2019; i++)
	{
		Hundred = i / 100 % 10 ;
		Ten = i / 10 % 10 ;
		One = i % 10;
		if (Hundred == 9 || Ten == 9 ||  One == 9)
		{
			//printf("%d ", i);
			sum++;
			//if (sum % 5 == 0)
			//{
				//printf("\n");
			//}
		}
	}
	printf("%d", sum);
	return 0;
}