local mfl, mce = math.floor, math.ceil
local n = io.read("*n")
local a, b = {}, {}
for i = 1, n do
  a[i], b[i] = io.read("*n", "*n")
end

local function solvelow(x)
  local c = 0
  for i = 1, n do
    if a[i] <= x then
      c = c + 1
    end
  end
  return n + 1 <= c * 2
end

local function solvehigh(x)
  local c = 0
  for i = 1, n do
    if x <= b[i] then
      c = c + 1
    end
  end
  return n + 1 <= c * 2
end

local function solvelow_even(x)
  local c = 0
  local lowmax, highmin = -1, 1000000007
  for i = 1, n do
    if a[i] <= x then
      c = c + 1
      if lowmax < a[i] then
        lowmax = a[i]
      end
    else
      if a[i] < highmin then
        highmin = a[i]
      end
    end
  end
  if n < c * 2 then return true
  elseif n == c * 2 then
    local diff = x - lowmax
    return highmin - x <= diff
  else
    return false
  end
end

local function solvehigh_even(x)
  local c = 0
  local lowmax, highmin = -1, 1000000007
  for i = 1, n do
    if x <= b[i] then
      c = c + 1
      if b[i] < highmin then
        highmin = b[i]
      end
    else
      if lowmax < b[i] then
        lowmax = b[i]
      end
    end
  end
  if n < c * 2 then return true
  elseif n == c * 2 then
    local diff = highmin - x
    return x - lowmax <= diff
  else
    return false
  end
end
local function solvehigh(x)
  local c = 0
  for i = 1, n do
    if x <= b[i] then
      c = c + 1
    end
  end
  return n + 1 <= c * 2
end

if n % 2 == 1 then
  local min, max = 0, 1000000000
  while 1 < max - min do
    local mid = mfl((min + max) / 2)
    if solvelow(mid) then
      max = mid
    else
      min = mid
    end
  end
  local lowlim = max
  min, max = 1, 1000000001
  while 1 < max - min do
    local mid = mfl((min + max) / 2)
    if solvehigh(mid) then
      min = mid
    else
      max = mid
    end
  end
  local highlim = min
  print(highlim - lowlim + 1)
else
  for i = 1, n do
    a[i], b[i] = a[i] * 2, b[i] * 2
  end
  local min, max = 0, 2000000000
  while 1 < max - min do
    local mid = mfl((min + max) / 2)
    if solvelow_even(mid) then
      max = mid
    else
      min = mid
    end
  end
  local lowlim = max
  min, max = 1, 2000000001
  while 1 < max - min do
    local mid = mfl((min + max) / 2)
    if solvehigh_even(mid) then
      min = mid
    else
      max = mid
    end
  end
  local highlim = min
  print(highlim - lowlim + 1)
end
