#include <iostream>
using namespace std;
long long d2(long long N) //2의 개수
{
long long cnt = 0;
for (long long i = 2; i <= N; i *= 2)
cnt += N / i;
return cnt;
}
long long d5(long long N) //5의 개수
{
long long cnt = 0;
for (long long i = 5; i <= N; i *= 5)
cnt += N / i;
return cnt;
}
int main(void)
{
long long n, m;
cin >> n >> m;
cout << min(d5(n) - d5(m) - d5(n - m), d2(n) - d2(m) - d2(n - m)); //조합 공식
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmxvbmcgbG9uZyBkMihsb25nIGxvbmcgTikJCS8vMuydmCDqsJzsiJgKewoJbG9uZyBsb25nIGNudCA9IDA7Cglmb3IgKGxvbmcgbG9uZyBpID0gMjsgaSA8PSBOOyBpICo9IDIpCgkJY250ICs9IE4gLyBpOwoJcmV0dXJuIGNudDsKfQoKbG9uZyBsb25nIGQ1KGxvbmcgbG9uZyBOKQkJLy817J2YIOqwnOyImAp7Cglsb25nIGxvbmcgY250ID0gMDsKCWZvciAobG9uZyBsb25nIGkgPSA1OyBpIDw9IE47IGkgKj0gNSkKCQljbnQgKz0gTiAvIGk7CglyZXR1cm4gY250Owp9CgppbnQgbWFpbih2b2lkKQp7Cglsb25nIGxvbmcgbiwgbTsKCWNpbiA+PiBuID4+IG07Cgljb3V0IDw8IG1pbihkNShuKSAtIGQ1KG0pIC0gZDUobiAtIG0pLCBkMihuKSAtIGQyKG0pIC0gZDIobiAtIG0pKTsJLy/sobDtlakg6rO17IudCn0=