unittest
{
	assert( [ "4 8 2" ].parse.expand.solve == 3 );
	assert( [ "0 5 1" ].parse.expand.solve == 6 );
	assert( [ "9 9 2" ].parse.expand.solve == 0 );
	assert( [ "1 1000000000000000000 3" ].parse.expand.solve == 333333333333333333 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto abx = input.front.split.to!( long[] );
	return tuple( abx[ 0 ], abx[ 1 ], abx[ 2 ] );
}

auto solve( long a, long b, long x )
{
	auto bc = ( b == 0 ) ? 1L : b / x + ( a == 0 );
	auto ac = ( a == 0 ) ? 0L : ( a - 1 ) / x;
	return bc - ac;
}
