import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val Array(a, b, x) = in.readLine().split("\\s+").map(_.toLong)

    out.println(b / x - a / x + (
      if (a % x == 0) {
        1
      } else {
        0
      }
      ))

    out.flush()
  }
}
