#include <stdio.h> int main() { int n, c, count, j, m; int temp = 0; m = 0, count = 0; scanf("%d%d", &n, &c); for (int i = 1; i <= n; i++) { temp = i; while (temp > 0) { m = temp % 10; if (m == c) count++; temp = temp / 10; } } printf("%d", count); }