N = int(input()) XY = [tuple(map(int, input().split())) for _ in range(N)] ans = float('inf') for x in range(1, 301): for y in range(1, 301): s = 0 for X, Y in XY: s += abs(x - X) + abs(y - Y) ans = min(ans, s) print(ans)