#include <iostream>
using namespace std;
 int k(int m, int i)
 {
	 int s=1;
	for(int r=0; r<=i; r++)
	{
		s=s*main;
	}
	return s;
} 
 int main()
 {
	 unsigned long long v, rez=0;
	 cin>>v;
	 int i=17;
	 while(i>=0)
	 {
		 rez=rez+(v%(k(10, i+1)))/(5*k(10, i));
		 rez=rez+(v%(5*k(10, i)))/(2*k(10, i));
		 rez=rez+(v%(5*k(10, i)))/(k(10, i));
		 i--;
	 }
	 
	 cout<<rez;
	 
  
     return 0;
 }