// Learn more about F# at http://fsharp.org
open System

[<EntryPoint>]
let main argv =
    let [ a; b; x ] =
        Console.ReadLine().Split(' ')
        |> List.ofArray
        |> List.map int64

    let underA =
        if a = 0L then 0L
        else (a - 1L) / x + 1L

    let BorUnder =
        if b = 0L then 0L
        else b / x + 1L

    let ans = BorUnder - underA
    printfn "%d" ans
    0 // return an integer exit code
