import Data.List

main = do
  li <- getLine
  let n = read li
  co <- getContents
  let [as,bs] = transpose $ map (map read . words) $ lines co
  let ans = compute n as bs
  print ans

-- pureforeverearthのコード
-- https://atcoder.jp/contests/abc169/submissions/13847654
-- をコピーしたもの。これで答えが求まる理屈は理解できていない

compute :: Int -> [Int] -> [Int] -> Int
compute n as bs
  | odd n = getNth n2 bs - getNth n2 as + 1
  | True  = getNth n2 bs + getNth n21 bs - getNth n2 as - getNth n21 as + 1
  where
    n2 = div n 2
    n21 = pred n2

getNth :: Ord a => Int -> [a] -> a
getNth 0 (x:_) = x
getNth n (x:xs) =
  case compare k n of
    LT -> getNth k bs
    EQ -> x
    GT -> getNth (k-n-1) as
  where
    (as,bs) = partition (x >) xs
    k = length as