#include <iostream>
using namespace std;
int main()
{
int a,b,c,d;
int p,pmin,pmax,i,j,imin,imax,jmin,jmax;
int rez,flag;
cin >>a>>b>>c>>d;
if (a<b)
{
imin=a;
imax=b;
}
else
{
imin=b;
imax=a;
}
if (c<d)
{
jmin=c;
jmax=d;
}
else
{
jmin=d;
jmax=c;
}
pmin=imin*jmin;
pmax=imax*jmax;
rez=0;
for (p=pmin; p<=pmax; p++)
{
flag=0;
for (int i=imin; i<=imax;i++)
{
j=p/i;
if ((p%i==0) && (j>=jmin) && (j<=jmax))
flag=1;
}
if (flag==1)
rez=rez+1;
}
cout << rez;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPiAKdXNpbmcgbmFtZXNwYWNlIHN0ZDsgCmludCBtYWluKCkKeyAKIGludCBhLGIsYyxkOyAKIGludCBwLHBtaW4scG1heCxpLGosaW1pbixpbWF4LGptaW4sam1heDsKIGludCByZXosZmxhZzsgCiBjaW4gPj5hPj5iPj5jPj5kOwogaWYgKGE8YikKICAgICB7CiAgICAgICAgIGltaW49YTsgCiAgICAgICAgIGltYXg9YjsKICAgICB9CiBlbHNlCiAgICAgewogICAgICAgICBpbWluPWI7IAogICAgICAgICBpbWF4PWE7CiAgICAgfQogaWYgKGM8ZCkKICAgICB7CiAgICAgICAgIGptaW49YzsgCiAgICAgICAgIGptYXg9ZDsKICAgICB9CiBlbHNlCiAgICAgewogICAgICAgICBqbWluPWQ7IAogICAgICAgICBqbWF4PWM7CiAgICAgfQogcG1pbj1pbWluKmptaW47CiBwbWF4PWltYXgqam1heDsKIHJlej0wOwogZm9yIChwPXBtaW47IHA8PXBtYXg7IHArKykKICAgICB7IAogICAgICAgICBmbGFnPTA7CiAgICAgICAgIGZvciAoaW50IGk9aW1pbjsgaTw9aW1heDtpKyspCiAgICAgICAgICAgICB7IAogICAgICAgICAgICAgICAgIGo9cC9pOwogICAgICAgICAgICAgICAgIGlmICgocCVpPT0wKSAmJiAoaj49am1pbikgJiYgKGo8PWptYXgpKQogICAgICAgICAgICAgICAgIGZsYWc9MTsKICAgICAgICAgICAgIH0KICAgICAgICAgaWYgKGZsYWc9PTEpCiAgICAgICAgIHJlej1yZXorMTsKICAgICB9CiBjb3V0IDw8IHJlejsgCiByZXR1cm4gMDsgCn0=