#include<iostream>
using namespace std;
int main()
{
int a,b;
while(cin>>a>>b)
{
if(a==0&&b==1)
cout<<b-a<<endl;
else if(a==1&&b==0)
cout<<a-b<<endl;
else if(a>b&&a!=1&&a%2==0||a>b&&a!=1&&b%2==0)
cout<<(a-b)/2+1<<endl;
else if(a<b&&b!=1&&a%2==0||a<b&&b!=1&&b%2==0)
cout<<(b-a)/2+1<<endl;
else if(a>b&&a!=1&&a/2!=0&&b/2!=0)
cout<<(a-b)/2<<endl;
else
cout<<(b-a)/2<<endl;
}
return 0;
}