#include <stdio.h> #include <stdlib.h> #include <string.h> #define max 30000 #define row 100 #define col 1001 //2021/7/3 - 18:28 //2021/7/3 - 18:39 int main() { int i, j, k, x; while (scanf("%d", &x) != EOF) { for (i = 7, j = 0; i <= x; i++) { k = i; if (i % 7 == 0) { j++; } else { while (k != 0)//check if contain 7 { if ((k % 10) == 7) { j++; break; } k /= 10; } } } printf("%d\n", j); } return 0; }