#include using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define ll long long const long long mod=998244353; const long long hmod=46216567629137; int main(){ cin.tie(0)->sync_with_stdio(0); cout.tie(0); int N; cin>>N; int cnt=0; for(int i=1;i<=N;i++){ string s=to_string(i); bool check=0; rep(j,s.size()){ if(s[j]=='8') check=1; } if(check) cnt++; } cout<