#include<bits/stdc++.h>
using namespace std;
long long x[200010],y[200010],r[200010],l[200010];int n;
long long sum1,sum2,minn;
long long mil1,mir1,mal1,mar1;
long long mil2,mir2,mal2,mar2;
int cmp(int x,int y)
{
	return x<y;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	scanf("%lld%lld",&x[i],&y[i]);
	l[1]=x[1];r[1]=y[1];
	for(int i=1;i<=n;i++)
	{
		if(x[i]>l[i-1])mal1=x[i];
		if(x[i]<l[1])mil1=x[i];
		if(y[i]>r[i-1])mar1=y[i];
		if(y[i]<r[1])mir1=y[i];
		sum1=(mal1-mil1)*(mar1-mir1);
		if(x[i]>r[i-1])mar2=x[i];
		if(x[i]<r[1])mir2=x[i];
		if(y[i]>l[i-1])mal2=y[i];
		if(y[i]<r[1])mil2=l[i];
		sum2=(mal2-mil2)*(mar2-mir2);
		if(sum1<=sum2)
		{
			l[i]=x[i];r[i]=y[i];
		}
		else
		{
			r[i]=x[i];l[i]=y[i];
		}
		minn=min(sum1,sum2);
		sort(r+1,r+1+i,cmp);
		mar1=mar2=r[i];mir1=mir2=r[1];
		sort(l+1,l+1+i,cmp);
		mal1=mal2=l[i];mil1=mil2=l[1];
	}
	cout<<minn;
	return 0;
} 