import sys

from io import StringIO

import unittest



def yn(b):

    print(("Yes" if b==1 else "No"))

    return



def resolve():

    readline=sys.stdin.readline



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

    if a%x==0:

        f=a

    else:

        f=a-a%x+x

        if f > b:

            print((0))

            return

    if b%x==0:

        t=b

    else:

        t=b-b%x

        if t<a:

            print((0))

            return

    print(((t-f)//x+1))



    return



if 'doTest' not in globals():

    resolve()

    sys.exit()
import sys



def yn(b):

    print(("Yes" if b==1 else "No"))

    return



def resolve():

    readline=sys.stdin.readline

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

    print((b//x - (a-1)//x))

    return



if 'doTest' not in globals():

    resolve()

    sys.exit()
import sys
from io import StringIO
import unittest


def yn(b):
    print(("Yes" if b == 1 else "No"))
    return


def resolve():
    readline = sys.stdin.readline
    a, b, x = list(map(int, readline().rstrip().split()))
    if a % x == 0:
        f = a
    else:
        f = a - a % x + x
        if f > b:
            print((0))
            return
    if b % x == 0:
        t = b
    else:
        t = b - b % x
        if t < a:
            print((0))
            return
    print(((t - f) // x + 1))
    return


if "doTest" not in globals():
    resolve()
    sys.exit()

import sys


def yn(b):
    print(("Yes" if b == 1 else "No"))
    return


def resolve():
    readline = sys.stdin.readline
    a, b, x = list(map(int, readline().rstrip().split()))
    print((b // x - (a - 1) // x))
    return


if "doTest" not in globals():
    resolve()
    sys.exit()

-from io import StringIO -import unittest -    if a % x == 0: -        f = a -    else: -        f = a - a % x + x -        if f > b: -            print((0)) -            return -    if b % x == 0: -        t = b -    else: -        t = b - b % x -        if t < a: -            print((0)) -            return -    print(((t - f) // x + 1)) +    print((b // x - (a - 1) // x))