#include <iostream> using namespace std; bool find7(int n){ if(n%7==0)return true; while(n){ if(n%10==7)return true; n = n/10; } return false; } int ans(int n){ int res=0; for(int i=7; i<=n;i++){ if(find7(i))res++; } return res; } int main() { int n; cin>>n; cout<<ans(n); } // 64 位输出请用 printf("%lld")