n = int(input())
points = [tuple(map(int, input().split())) for _ in range(n)]

if n == 0:
    print(0)
    exit()

# Extract x and y coordinates
sorted_x = sorted(x for x, y in points)
sorted_y = sorted(y for x, y in points)

# Determine initial medians
if n % 2 == 1:
    qx = sorted_x[n // 2]
    qy = sorted_y[n // 2]
else:
    qx = sorted_x[(n // 2) - 1]
    qy = sorted_y[(n // 2) - 1]

prev_qx, prev_qy = None, None

# Iterate until convergence
while (qx, qy) != (prev_qx, prev_qy):
    prev_qx, prev_qy = qx, qy

    # Compute new_qy based on current qx
    a = [abs(x - qx) for x, y in points]
    y_list = sorted(zip([y for x, y in points], a), key=lambda t: t[0])
    total_a = sum(a)
    new_qy = None

    if total_a == 0:
        new_qy = y_list[0][0] if y_list else 0
    else:
        target = total_a / 2
        cum = 0
        for y, w in y_list:
            cum += w
            if cum >= target:
                new_qy = y
                break

    # Compute new_qx based on new_qy
    b = [abs(y - new_qy) for x, y in points]
    x_list = sorted(zip([x for x, y in points], b), key=lambda t: t[0])
    total_b = sum(b)
    new_qx = None

    if total_b == 0:
        new_qx = x_list[0][0] if x_list else 0
    else:
        target_x = total_b / 2
        cum_x = 0
        for x, w in x_list:
            cum_x += w
            if cum_x >= target_x:
                new_qx = x
                break

    qx, qy = new_qx, new_qy

# Calculate the minimal sum
total_sum = 0
for x, y in points:
    total_sum += abs(x - qx) * abs(y - qy)

print(total_sum)