N = int(input()) xs, ys = [], [] for i in range(N): x, y = map(int, input().split()) xs.append(x) ys.append(y) ans = 10 ** 18 for x in range(310): for y in range(310): s = 0 for i in range(N): s += abs(xs[i] - x) + abs(ys[i] - y) ans = min(ans, s) print(ans)