fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = mutableListOf<Long>()
    val b = mutableListOf<Long>()
    (1..n).forEach { _ ->
        val (x, y) = readLine()!!.split(" ").map { it.toLong() }
        a.add(x); b.add(y)
    }
    a.sort(); b.sort()
    if(n%2 == 0){
        val l = n/2-1; val r = n/2
        println(b[r]+b[l]-a[r]-a[l]+1)
    }else{
        val m = (n-1)/2
        println(b[m]-a[m]+1)
    }
}