#include<stdio.h>
int main()
{
	long long int a,b,x,c=0,y;
	scanf("%lld %lld %lld",&a,&b,&x);
	if(a==b)
	{
		if(a%x==0)
		y=1;
		else
		y=0;
		
	}
	else
	{
		if(a%x==0)
		c++;
		else if(b%x==0)
		c++;
		y=c+(b-a)/x;
	}
	printf("%lld",y);
	return 0;
}
		