def solve(N, X, Y): ans = 10 ** 9 for xc in range(-310, 310): sx = sum(abs(xi - xc) for xi in X) for yc in range(-310, 310): sy = sum(abs(yi - yc) for yi in Y) s = sx + sy ans = min(s, ans) return ans N = int(input()) X = [] Y = [] for _ in range(N): xi, yi = [int(x) for x in input().split()] X.append(xi) Y.append(yi) print(solve(N, X, Y))