import java.io.IOException
import java.io.InputStream
import java.io.PrintWriter
import java.util.*

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)
    val out = PrintWriter(System.out)
    solve(sc, out)
    out.flush()
}

fun solve(sc: FastScanner, out: PrintWriter) {
    val a = sc.nl()
    val b = sc.nl()
    val x = sc.nl()
    out.println(count(b, x) - count(a - 1, x))
}

fun count(max: Long, num: Long): Long {
    if (max < 0) return 0
    return max / num + 1
}

class FastScanner(private val `is`: InputStream) {
    private val inbuf = ByteArray(1024)
    private var lenbuf = 0
    private var ptrbuf = 0

    fun nc(): Char {
        return skip().toChar()
    }

    fun nca(n: Int): CharArray {
        val buf = CharArray(n)
        var b = skip()
        var p = 0
        while (p < n && !isSpaceChar(b)) {
            buf[p++] = b.toChar()
            b = readByte()
        }
        return if (n == p) buf else Arrays.copyOf(buf, p)
    }

    fun nca2(n: Int, m: Int): Array<CharArray> {
        val buf = Array(m) { CharArray(n) }
        for (i in 0..m - 1) {
            buf[i] = nca(n)
        }
        return buf
    }

    fun ns(): String {
        var b = skip()
        val sb = StringBuilder()
        while (!isSpaceChar(b)) {
            sb.appendCodePoint(b)
            b = readByte()
        }
        return sb.toString()
    }

    fun ni(): Int {
        val zero = '0'.toInt()
        val nine = '9'.toInt()
        val minus = '-'.toInt()
        var num = 0
        var b: Int
        var is_minus = false
        do {
            b = readByte()
        } while (b != -1 && !(b in zero..nine || b == minus))
        if (b == minus) {
            is_minus = true
            b = readByte()
        }
        while (true) {
            if (b in zero..nine) {
                num = num * 10 + (b - zero)
            } else {
                return if (is_minus) -num else num
            }
            b = readByte()
        }
    }

    fun nia(n: Int): IntArray {
        val a = IntArray(n)
        for (i in 0..n - 1) a[i] = ni()
        return a
    }

    fun nl(): Long {
        val zero = '0'.toInt()
        val nine = '9'.toInt()
        val minus = '-'.toInt()
        var num: Long = 0
        var b: Int
        var is_minus = false
        do {
            b = readByte()
        } while (b != -1 && !(b in zero..nine || b == minus))
        if (b == minus) {
            is_minus = true
            b = readByte()
        }
        while (true) {
            if (b in zero..nine) {
                num = num * 10 + (b - zero)
            } else {
                return if (is_minus) -num else num
            }
            b = readByte()
        }
    }

    fun nd(): Double {
        return java.lang.Double.parseDouble(ns())
    }

    private fun readByte(): Int {
        if (lenbuf == -1) throw InputMismatchException()
        if (ptrbuf >= lenbuf) {
            ptrbuf = 0
            try {
                lenbuf = `is`.read(inbuf)
            } catch (e: IOException) {
                throw InputMismatchException()
            }

            if (lenbuf <= 0) return -1
        }
        return inbuf[ptrbuf++].toInt()
    }

    private fun skip(): Int {
        var b: Int
        do {
            b = readByte()
        } while (b != -1 && isSpaceChar(b))
        return b
    }

    private fun isSpaceChar(c: Int): Boolean {
        return !(c >= 33 && c <= 126)
    }
}


Measured memory_bytes: 31400