N = gets.to_i X = [] Y = [] N.times do x, y = gets.split.map(&:to_i) X << x Y << y end cx = X.sort[N / 2] cy = Y.sort[N / 2] ans = X.map { |x| (x - cx).abs }.sum + Y.map { |y| (y - cy).abs }.sum puts ans