#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,i,r=0,g,s,b,q,w;
    cin>>n;
    for(i=10000;i<=n;i++){
        w=i/10000;
        q=i/1000%10;
        b=i/100%10;
        s=i/10%10;
        g=i%10;
        if(w%2==0&&q%2==0&&b%2==0&&s%2==0&&g%2==0){
            r=r+1;
        }
    }
    cout<<r;
}
/**************************************************************
	Problem: 1745
	User: linzihang
	Language: C++
	Result: Accepted
	Time:10 ms
	Memory:2072 kb
****************************************************************/