object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val a, b, x = sc.nextLong
  val count = calc(b, x) - calc((a - 1), x)
  println(count)

  private def calc(v: Long, x: Long): Long = {
    if (v < 0) 0 else v / x
  }
}
