#include<bits/stdc++.h>
using namespace std;
int main(){
    int i=1,n,a,b,c,d,e,h=0;
    cin>>n;
    for(i=1;i<=n;i++){
        a=i%10;
        b=i/10%10;
        c=i/100%10; 
        d=i/1000%10;
        e=i/10000;
        if(i%5==0&&(a==5||b==5||c==5||d==5||e==5))
         h++;
    }
        cout<<h<<endl;
    }
/**************************************************************
	Problem: 1057
	User: wngjinming
	Language: C++
	Result: Accepted
	Time:19 ms
	Memory:2072 kb
****************************************************************/