import sys



sys.setrecursionlimit(10 ** 7)

f_inf = float('inf')

mod = 10 ** 9 + 7





def resolve():

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

    print((b // x + 1 - max(0, (a - 1) // x + 1)))





if __name__ == '__main__':

    resolve()

import sys



sys.setrecursionlimit(10 ** 7)

input = sys.stdin.readline

f_inf = float('inf')

mod = 10 ** 9 + 7





def resolve():

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



    res_a = (a - 1) // x

    res_b = b // x

    print((res_b - res_a))





if __name__ == '__main__':

    resolve()

import sys

sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7


def resolve():
    a, b, x = list(map(int, input().split()))
    print((b // x + 1 - max(0, (a - 1) // x + 1)))


if __name__ == "__main__":
    resolve()

import sys

sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7


def resolve():
    a, b, x = list(map(int, input().split()))
    res_a = (a - 1) // x
    res_b = b // x
    print((res_b - res_a))


if __name__ == "__main__":
    resolve()

+input = sys.stdin.readline -    print((b // x + 1 - max(0, (a - 1) // x + 1))) +    res_a = (a - 1) // x +    res_b = b // x +    print((res_b - res_a))