#include <iostream> #include <string> using namespace std; int main() { int n; while (cin >> n) { int res = 0; for (int i = 1; i <= n; ++i) { if (i % 7 == 0) { ++res; continue; } else { string str = to_string(i); for (auto j : str) { if (j == '7') { ++res; break; } } } } cout << res << endl; } return 0; }