fun main(args: Array<String>) {
    val (a, b, x) = readLine()?.split(" ")?.map { it.toLong() } ?: return

    if (a == b) {
        println(if (a % x == 0L) 1 else 0)
        return
    }

    val toA = if (a == 0L) -1 else (a - 1) / x
    val toB = b / x

    println(toB - toA)
}