fun main() {
    val builder = StringBuilder()

    val n = readInputLine().toInt()

    val aArr = LongArray(n)
    val bArr = LongArray(n)

    repeat(n) {
        val (a, b) = readInputLine().split(" ").map { it.toLong() }
        aArr[it] = a
        bArr[it] = b
    }

    aArr.sort()
    bArr.sort()

    if ((n and 1) == 0) {
        val min = aArr[n / 2 - 1] + aArr[n / 2]
        val max = bArr[n / 2 - 1] + bArr[n / 2]
        builder.appendln(max - min + 1)
    } else {
        val min = aArr[(n + 1) / 2 - 1]
        val max = bArr[(n + 1) / 2 - 1]
        builder.appendln(max - min + 1)
    }

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}
