#include <iostream> #include <string> #include <set> using namespace std; int main () { int n; set<int> s; while(cin>>n) { for (int i=7;i<=n;i++) { if (i%7==0) s.insert(i); string s1=to_string(i); if (s1.find('7')!=string::npos) s.insert(atoi(s1.c_str())); } cout<<s.size()<<endl; /*set<int>::iterator it; for (it=s.begin();it!=s.end();it++) cout<<*it<<" ";*/ s.clear(); } }