Scanf.scanf "%d" (fun n ->
    let a = Array.make n 0 in
    let b = Array.make n 0 in
    for i = 0 to n - 1 do
        Scanf.scanf " %d %d" (fun aa bb -> a.(i) <- aa; b.(i) <- -bb)
    done;
    Array.sort compare a;
    Array.sort compare b;

    let mi = a.((n - 1) / 2) + a.(n / 2) in
    let mx = b.((n - 1) / 2) + b.(n / 2) in

    Printf.printf "%d\n" @@ if n mod 2 = 0 then -mx - mi + 1 else (-mx - mi) / 2 + 1
)