stdin.ReadLine()
|> fun x -> x.Split(' ')
|> Array.map uint64
|> fun x -> (x.[0], x.[1], x.[2])
|> fun (a, b, x) ->
    (b - a + 1UL) / x + if x > 1UL && a % x = 0UL && b % x = 0UL then 1UL else 0UL
    |> printfn "%d"
