def main(): import sys input = sys.stdin.read().split() idx = 0 n = int(input[idx]) idx += 1 x_list = [] y_list = [] for _ in range(n): x = int(input[idx]) y = int(input[idx+1]) x_list.append(x) y_list.append(y) idx +=2 def get_candidates(arr): arr_sorted = sorted(arr) m = len(arr_sorted) # Generate indices around the median candidates = set() if m ==0: return [] # Median positions if m %2 ==1: mid = m//2 indices = [mid] else: mid_left = (m//2)-1 mid_right = m//2 indices = [mid_left, mid_right] # Extend around the median indices for i in indices: for delta in range(-5,6): idx_candidate = i + delta if 0 <= idx_candidate < m: candidates.add(arr_sorted[idx_candidate]) # Also add the elements at start and end in case of sparse distribution candidates.add(arr_sorted[0]) candidates.add(arr_sorted[-1]) return list(candidates) x_candidates = get_candidates(x_list) y_candidates = get_candidates(y_list) min_sum = float('inf') for x in x_candidates: for y in y_candidates: current_sum = 0 for i in range(n): xi = x_list[i] yi = y_list[i] if xi ==x or yi ==y: continue current_sum += abs(xi -x) * abs(yi - y) if current_sum < min_sum: min_sum = current_sum print(min_sum) if __name__ == "__main__": main()