#include <iostream>
#include <algorithm>
using namespace std;
// 计算跟7有关的数字的个数,是7的倍数或者是数字中包含其
static int selectRelative7(int n) {
int count = 0;
for (int i = 1; i <= n; i++) {
if (i % 7 == 0) {
count++;
}
else {
string s = to_string(i);
if (find(s.begin(), s.end(), '7') != s.end()) {
count++;
}
}
}
return count;
}
int main()
{
int n;
while (cin >> n) {
cout << selectRelative7(n) << endl;
}
return 0;
}

京公网安备 11010502036488号