#include <bits/stdc++.h>
using namespace std;
int main(){
int a,s,d,f,g,h,j=0,k;
cin>>a;
for(k=10000;k<=a;k++){
s=k%10;
d=k/10%10;
f=k/100%10;
g=k/1000%10;
h=k/10000;
if(s%2==0&&d%2==0&&g%2==0&&h%2==0&&s%2==0){
j=j+1;
}
}cout<<j;
}
/**************************************************************
Problem: 1745
User: tonghuawei
Language: C++
Result: Wrong Answer
****************************************************************/