object Main extends App {
  val input = io.Source.stdin.getLines.toSeq.head.split(' ').map(_.toLong)
  val a=input(0)
  val b=input(1)
  val x=input(2)
  
  if(x==1) println(b-a+1)
  else {
    val ax=if(a==0) 0 else (a-1)/x
  	val bx=b/x
  	val ret=bx-ax
  	println(ret)
  }
}
