from decimal import *

#exp = Decimal(10**23)

#rint((Decimal(11)*exp)/Decimal(10))



## coding: UTF-8

s = input().split()

t = [int(p) for p in s]

#print(t)



a = t[0]

b = t[1]

x = t[2]



'''

start = a

goal = b

while True:

    if(start % x == 0):

        break

    else:

        start += 1

#print(start)

while True:

    if(goal % x == 0):

        break

    else:

        goal -= 1

#start = Decimal(3)

#goal = Decimal(999999999999999999)



#print(Decimal(goal))

print(Decimal(Decimal(Decimal(goal) - Decimal(start)) / Decimal(x)) + Decimal(1)  ) 

#answer = ((goal - start) / x ) + 1

#print('{}'.format(int(answer)))

'''



def count_even(t, x):

    return int( Decimal(t)/ Decimal(x) )



if( a == 0):

    answer = count_even(b, x) + 1

else:

    answer = count_even(b, x) - count_even(a-1, x)

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



if(a%x == 0):

    A = a//x

else:

    A = a//x + 1



B = b//x

print((B-A+1))
from decimal import *

# exp = Decimal(10**23)
# rint((Decimal(11)*exp)/Decimal(10))
## coding: UTF-8
s = input().split()
t = [int(p) for p in s]
# print(t)
a = t[0]
b = t[1]
x = t[2]
"""
start = a
goal = b
while True:
    if(start % x == 0):
        break
    else:
        start += 1
#print(start)
while True:
    if(goal % x == 0):
        break
    else:
        goal -= 1
#start = Decimal(3)
#goal = Decimal(999999999999999999)
#print(Decimal(goal))
print(Decimal(Decimal(Decimal(goal) - Decimal(start)) / Decimal(x)) + Decimal(1)  ) 
#answer = ((goal - start) / x ) + 1
#print('{}'.format(int(answer)))
"""


def count_even(t, x):
    return int(Decimal(t) / Decimal(x))


if a == 0:
    answer = count_even(b, x) + 1
else:
    answer = count_even(b, x) - count_even(a - 1, x)
print(answer)

a, b, x = list(map(int, input().split()))
if a % x == 0:
    A = a // x
else:
    A = a // x + 1
B = b // x
print((B - A + 1))

-from decimal import * - -# exp = Decimal(10**23) -# rint((Decimal(11)*exp)/Decimal(10)) -## coding: UTF-8 -s = input().split() -t = [int(p) for p in s] -# print(t) -a = t[0] -b = t[1] -x = t[2] -""" -start = a -goal = b -while True: -    if(start % x == 0): -        break -    else: -        start += 1 -#print(start) -while True: -    if(goal % x == 0): -        break -    else: -        goal -= 1 -#start = Decimal(3) -#goal = Decimal(999999999999999999) -#print(Decimal(goal)) -print(Decimal(Decimal(Decimal(goal) - Decimal(start)) / Decimal(x)) + Decimal(1)  ) -#answer = ((goal - start) / x ) + 1 -#print('{}'.format(int(answer))) -""" - - -def count_even(t, x): -    return int(Decimal(t) / Decimal(x)) - - -if a == 0: -    answer = count_even(b, x) + 1 +a, b, x = list(map(int, input().split())) +if a % x == 0: +    A = a // x -    answer = count_even(b, x) - count_even(a - 1, x) -print(answer) +    A = a // x + 1 +B = b // x +print((B - A + 1))