local n = io.read("*n") local x, y = {}, {} for i = 1, n do x[i], y[i] = io.read("*n", "*n") end table.sort(x) table.sort(y) local hn = math.ceil(n / 2) local z = 0 for i = 1, n do z = z + math.abs(x[i] - x[hn]) + math.abs(y[i] - y[hn]) end print(z)