#!/usr/bin/env python



a, b, x = list(map(int, input().split()))



if a == b:

    if a%x == 0:

        print((1))

    else:

        print((0))

    exit()

if a%x == 0 and b%x == 0:

    ans = b//x - a//x + 1 

    print(ans)

    exit()

if a%x != 0 and b%x != 0:

    ans = b//x - a//x

    print(ans)

    exit()

if a%x == 0 and b%x != 0:

    ans = b//x - a//x + 1 

    print(ans)

    exit()

ans = b//x - a//x 

print(ans)

#!/usr/bin/env python



a, b, x = list(map(int, input().split()))



def f(n):

    global x

    if n == -1: 

        return 0

    return n//x + 1 



ans = f(b)-f(a-1)

print(ans)

#!/usr/bin/env python
a, b, x = list(map(int, input().split()))
if a == b:
    if a % x == 0:
        print((1))
    else:
        print((0))
    exit()
if a % x == 0 and b % x == 0:
    ans = b // x - a // x + 1
    print(ans)
    exit()
if a % x != 0 and b % x != 0:
    ans = b // x - a // x
    print(ans)
    exit()
if a % x == 0 and b % x != 0:
    ans = b // x - a // x + 1
    print(ans)
    exit()
ans = b // x - a // x
print(ans)

#!/usr/bin/env python
a, b, x = list(map(int, input().split()))


def f(n):
    global x
    if n == -1:
        return 0
    return n // x + 1


ans = f(b) - f(a - 1)
print(ans)

-if a == b: -    if a % x == 0: -        print((1)) -    else: -        print((0)) -    exit() -if a % x == 0 and b % x == 0: -    ans = b // x - a // x + 1 -    print(ans) -    exit() -if a % x != 0 and b % x != 0: -    ans = b // x - a // x -    print(ans) -    exit() -if a % x == 0 and b % x != 0: -    ans = b // x - a // x + 1 -    print(ans) -    exit() -ans = b // x - a // x + + +def f(n): +    global x +    if n == -1: +        return 0 +    return n // x + 1 + + +ans = f(b) - f(a - 1)