import Data.List

main = do
 n <- readLn
 xys <- map (map read . words) . lines <$> getContents
 let xs = sort (map head xys)
 let ys = sort (map last xys)
 print (built n xs ys)

built n xs ys
 | odd n = sum (take (div n 2) dxs) + sum (take (div n 2) dys)
 | otherwise = sum (tail (take (div n 2) dxs)) + sum (tail (take (div n 2) dys))
 where
  dxs = sort (zipWith (-) (tail xs) xs)
  dys = sort (zipWith (-) (tail ys) ys)