#include<stdio.h>

int main()
{
     long long int a,b,c,d;
    scanf("%lld %lld",&a,&b);
    if(a>b)c=a-b;
    else c=b-a;
    d=c/2;
    if (d<=a&&d<=b)
    printf("%lld",d);
    else printf("0");
    return 0;
}