#include <iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<vector>
using namespace std;

typedef pair<int,int> p;
/*4
int ans[105][40];
int lcm[105][105];
int main()
{
    return 0;
}*/

/*5*/

int max(int a,int b)
{
    return a > b?a:b;
}
int main()
{
    char s[500];
    int i,mx,mn,ans,in,out;
    while(scanf("%s",s) != EOF)
    {
        in = out = 0;
        ans = 0;
        for(i = 0;i < strlen(s);i ++)
        {
            if(s[i] == '+')
            {
                if(out > 0)
                {
                    out --;
                    in ++;
                }
                else
                {
                    ans ++;
                    in ++;
                }
            }
            else
            {
                if(in > 0)
                {
                    in --;
                    out ++;
                }
                else
                {
                    ans ++;
                    out ++;
                }
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}


#include <iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<vector>
using namespace std;

typedef pair<int,int> p;

int max(int a,int b)
{
    return a > b?a:b;
}
int main()
{
    char s[500];
    int i,mx,mn,ans,in,out;
    while(scanf("%s",s) != EOF)
    {
        in = out = 0;
        ans = mx = mn = 400;
//        mx = -1;
//        mn = 1000;
        for(i = 0;i < strlen(s);i ++)
        {
            if(s[i] == '+')
                ans ++;
            else
                ans --;
            if(ans > mx)
                mx = ans;
            if(ans < mn)
                mn = ans;
        }

        printf("%d\n",abs(mx - mn));
    }
    return 0;
}


#include <iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<vector>
using namespace std;

typedef pair<int,int> p;
/*
int ans[105][40];
int lcm[105][105];
int main()
{
    return 0;
}*/

/*5*/

int max(int a,int b)
{
    return a > b?a:b;
}
int main()
{
    char s[500];
    int i,mx,mn,ans;
    while(scanf("%s",s) != EOF)
    {
        mx = -1;
        mn = 1000;
        ans = 400;
        for(i = 0;i < strlen(s);i ++)
        {
            if(s[i] == '+')
                ans ++;
            else
                ans --;
            if(ans > mx)
                mx = ans;
            if(ans < mn)
                mn = ans;
        }
        printf("%d\n",max(mx - 400,400 - mn));
    }
    return 0;
}


#include <stdio.h>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
#include <stack>
#define sc scanf
using namespace std;

int main(){
int m=0,p=0;
char c[303],tc;
sc("%s",&c);
string s(c);
tc=s[0];
stack<char> plus,minus;
for (int i=0; i<s.size(); i++) {
    if (s[i]==tc) p++;
    else {
        if (m<p)m=p;
        tc=s[i]; p=1;
    }
    if (s[i]=='+'){
        if (minus.empty()) plus.push('+');
        else minus.pop();
    }
    else {
        if (plus.empty()) minus.push('+');
        else plus.pop();
    }
    if (plus.size()>m) m=plus.size();
    if (minus.size()>m) m=minus.size();
}

printf("%d",m);
return 0;
}


#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <string>
using namespace std;
int main()
{
int n,ans=0,p=0,m=0;
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
char c[301];
gets(c);
string s(c);
for (int i=0; i<s.size(); i++)
if (s[i]=='+'){
p++; m=max(0,m-1);
}
else {
m++; p=max(0,p-1);
}
printf("%d",p+m);

return 0;
}


#include <stdio.h>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
#include <stack>
#define sc scanf
using namespace std;

int main(){
int m=0,p=1;
char c[301],tc;
sc("%s",&c);
string s(c);
tc=s[0];
stack<char> plus,minus;
for (int i=0; i<s.size(); i++) {
    if (s[i]=='+'){
        if (minus.empty()) plus.push('+');
        else minus.pop();
    }
    else {
        if (plus.empty()) minus.push('+');
        else plus.pop();
    }
    if (plus.size()>m) m=plus.size();
    if (minus.size()>m) m=minus.size();
}

printf("%d",m);
return 0;
}


#include <stdio.h>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
#include <map>
#define sc scanf
using namespace std;

int main(){
int m=0,p=1;
char c[301],tc;
sc("%s",&c);
string s(c),rez;
tc=s[0];
for (int i=1; i<s.size(); i++) {
    if (s[i]==tc) p++;
    else {
        if (m<p)m=p;
        tc=s[i]; p=0;
    }
}
if (m<p) m=p;
printf("%d",m);
return 0;
}


#include <stdio.h>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
#include <map>
#define sc scanf
using namespace std;

int main(){
int m=0,p=1;
char c[301],tc;
sc("%s",&c);
string s(c),rez;
tc=s[0];
for (int i=1; i<s.size(); i++) {
    if (s[i]==tc) p++;
    else {
        if (m<p)m=p;
        tc=s[i]; p=1;
    }
}
if (m<p) m=p;
printf("%d",m);
return 0;
}


#include <stdio.h>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
#include <stack>
#define sc scanf
using namespace std;

int main(){
int m=0,p=0;
char c[302],tc;
sc("%s",&c);
string s(c);
tc=s[0];
stack<char> plus,minus;
for (int i=0; i<s.size(); i++) {
    if (s[i]==tc) p++;
    else {
        if (m<p)m=p;
        tc=s[i]; p=1;
    }
    if (s[i]=='+'){
        if (minus.empty()) plus.push('+');
        else minus.pop();
    }
    else {
        if (plus.empty()) minus.push('+');
        else plus.pop();
    }
    if (plus.size()>m) m=plus.size();
    if (minus.size()>m) m=minus.size();
}

printf("%d",m);
return 0;
}


#include <stdio.h>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
#include <stack>
#define sc scanf
using namespace std;

int main(){
int m=0,p=1;
char c[301],tc;
sc("%s",&c);
string s(c);
tc=s[0];
stack<char> plus,minus;
for (int i=0; i<s.size(); i++) {
    if (s[i]==tc) p++;
    else {
        if (m<p)m=p;
        tc=s[i]; p=1;
    }
    if (s[i]=='+'){
        if (minus.empty()) plus.push('+');
        else minus.pop();
    }
    else {
        if (plus.empty()) minus.push('+');
        else plus.pop();
    }
    if (plus.size()>m) m=plus.size();
    if (minus.size()>m) m=minus.size();
}

printf("%d",m);
return 0;
}


#include <stdio.h>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
#include <stack>
#define sc scanf
using namespace std;

int main(){
int m=0,p=0;
char c[303],tc;
sc("%s",&c);
string s(c);
tc=s[0];
stack<char> plus,minus;
for (int i=0; i<s.size(); i++) {
    if (s[i]==tc) p++;
    else {
        if (m<p)m=p;
        tc=s[i]; p=1;
    }
    if (s[i]=='+'){
        if (minus.empty()) plus.push('+');
        else minus.pop();
    }
    else {
        if (plus.empty()) minus.push('+');
        else plus.pop();
    }
    if (plus.size()>m) m=plus.size();
    if (minus.size()>m) m=minus.size();
}
if (m<p)m=p;
printf("%d",m);
return 0;
}


#include <stdio.h>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
#include <stack>
#define sc scanf
using namespace std;

int main(){
int m=0,p=0;
char c[301],tc;
sc("%s",&c);
string s(c);
tc=s[0];
stack<char> plus,minus;
for (int i=0; i<s.size(); i++) {
    if (s[i]==tc) p++;
    else {
        if (m<p)m=p;
        tc=s[i]; p=1;
    }
    if (s[i]=='+'){
        if (minus.empty()) plus.push('+');
        else minus.pop();
    }
    else {
        if (plus.empty()) minus.push('+');
        else plus.pop();
    }
    if (plus.size()>m) m=plus.size();
    if (minus.size()>m) m=minus.size();
}

printf("%d",m);
return 0;
}


/*
 * File:   main.cpp
 * Author: Hrayr [HarHro94]
 * Problem: Codeforces Croc , ACM-ICPC style
 * IDE: Visual C++
 */
#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <set>
using namespace std;

int main()
{
//  freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
    int i,out=0,in=0,res=0;
    string st;
    cin >> st;
    for(i=0;i<st.size();++i)
    {
        if (st[i]=='+')
        {
            if (!out)
            {
                ++res;
            }
            else
            {
                --out;
            }
            ++in;
        }
        else
        {
            if (!in)
            {
                ++res;
            }
            else
            {
                --in;
            }
            ++out;
        }
    }
    cout << res << endl;
    return 0;
}


/*
 * File:   main.cpp
 * Author: Hrayr [HarHro94]
 * Problem: Codeforces Croc , ACM-ICPC style
 * IDE: Visual C++
 */
#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <set>
using namespace std;

string st;

int main()
{
//  freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
    int i,s,cnt1=0,cnt2=0;
    cin >> st;
    for(i=0;i<st.size();++i)
    {
        if (st[i]=='+')
        {
            cnt1++;
        }
        else
        {
            cnt2++;
        }
    }
    if (cnt1==cnt2)
    {
        cout << 1 << endl;
    }
    else if (cnt1>cnt2)
    {
        s=(cnt2? 1:0);
        cout << s+cnt1-cnt2 << endl;
    }
    else
    {
        s=(cnt1? 1:0);
        cout << s+cnt2-cnt1 << endl;
    }
    return 0;
}


/*
 * File:   main.cpp
 * Author: Hrayr [HarHro94]
 * Problem: Codeforces Croc , ACM-ICPC style
 * IDE: Visual C++
 */
#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <set>
using namespace std;

string st;

int main()
{
//  freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
    int i,s,cnt1=0,cnt2=0;
    cin >> st;
    for(i=0;i<st.size();++i)
    {
        if (st[i]=='+')
        {
            cnt1++;
        }
        else
        {
            cnt2++;
        }
    }
    if (cnt1==cnt2)
    {
        cout << 1 << endl;
    }
    else if (cnt1>cnt2)
    {
        if (cnt2==0)
        {
            cout << cnt1 << endl;
        }
        else
        {
            cout << cnt1-cnt2 << endl;
        }
    }
    else
    {
        s=(cnt1? 1:0);
        cout << s+cnt2-cnt1 << endl;
    }
    return 0;
}


/*
 * File:   main.cpp
 * Author: Hrayr [HarHro94]
 * Problem: Codeforces Croc , ACM-ICPC style
 * IDE: Visual C++
 */
#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <set>
using namespace std;

string st;

bool doPair()
{
    int i,j;
    for(i=0;i<st.size();++i)
    {
        for(j=i+1;j<st.size();++j)
        {
            if (st[i]=='+' && st[j]=='-')
            {
                st.erase(st.begin()+i);
                st.erase(st.begin()+j-1);
                return 1;
            }
        }
    }
    return 0;
}

int main()
{
//  freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
    int i,f=0,res=0;
    cin >> st;
    while(doPair())
    {
        res=1;
    }
    for(i=0;i<st.size();++i)
    {
        if (st[i]=='+')
        {
            f=1;
        }
    }
    if (res && f)
    {
        cout << 1+st.size()-1 << endl;
    }
    else if (res && !f)
    {
        cout << 1+st.size() << endl;
    }
    else
    {
        cout << st.size() << endl;
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <string>
#include <string.h>
#include <iterator>
#include <cstdlib>
#include<stack>
#include<map>
#include<set>
#define inff 0x1f
#define EPS 1e-9
#define maxm 200000000
#define MAXN 100002
#define inf 1000000000
const long long INF =1000000000;
#define L(x) (x<<1)
#define R(x) (x<<1|1)
#define N  100002
#define mod 1000000007
//#define pi acos(-1.0)
#define pi  3.1415926535897932
using namespace std;
char sta[302];
char s[302];
int main() {
   //freopen("E:\\in.txt","r",stdin);
   //freopen("E:\\out.txt","w",stdout);
   //setbuf(stdout,NULL);
   int len=0;
   while(scanf("%s",s)!=EOF)
   {
         len=0;
         int i,ans=0;
         int l=0,r=0;
         for(i=0;s[i];i++)
         {
             if(s[i]=='+')
             {
//               if(len>0&&sta[len-1]=='-') len--;
//                else
//                {
//                  sta[len++]='+';
//                  ans++;
//                }
                 if(r>0)
                 {
                     r--;
                     l++;
                 }
                 else
                 {
                     l++;
                     ans++;
                 }
             }
             else
             {
                  if(l>0)
                  {
                       l--;
                       r++;
                  }
                  else
                  {
                     r++;
                     ans++;
                  }
//                if(len>0&&sta[len-1]=='+') len--;
//                else
//                {
//                    sta[len++]='-';
//                    ans++;
//                }
             }
         }
         printf("%d\n",ans);
   }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <string>
#include <string.h>
#include <iterator>
#include <cstdlib>
#include<stack>
#include<map>
#include<set>
#define inff 0x1f
#define EPS 1e-9
#define maxm 200000000
#define MAXN 100002
#define inf 1000000000
const long long INF =1000000000;
#define L(x) (x<<1)
#define R(x) (x<<1|1)
#define N  100002
#define mod 1000000007
//#define pi acos(-1.0)
#define pi  3.1415926535897932
using namespace std;
char sta[302];
char s[302];
int main() {
   //freopen("E:\\in.txt","r",stdin);
   //freopen("E:\\out.txt","w",stdout);
   //setbuf(stdout,NULL);
   int len=0;
   while(scanf("%s",s)!=EOF)
   {
         len=0;
         int i,ans=0;
         for(i=0;s[i];i++)
         {
             if(s[i]=='+')
             {
                 if(len>0&&sta[len-1]=='-') len--;
                  else
                                  {
                                      sta[len++]='+';
                                  }
             }
             else
             {
                  if(len>0&&sta[len-1]=='+') len--;
                  else
                  {
                      sta[len++]='-';
                  }
             }
             if(len>ans) ans=len;
         }
         printf("%d\n",ans);
   }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <string>
#include <string.h>
#include <iterator>
#include <cstdlib>
#include<stack>
#include<map>
#include<set>
#define inff 0x1f
#define EPS 1e-9
#define maxm 200000000
#define MAXN 100002
#define inf 1000000000
const long long INF =1000000000;
#define L(x) (x<<1)
#define R(x) (x<<1|1)
#define N  100002
#define mod 1000000007
//#define pi acos(-1.0)
#define pi  3.1415926535897932
using namespace std;
char sta[302];
char s[302];
int main() {
   //freopen("E:\\in.txt","r",stdin);
   //freopen("E:\\out.txt","w",stdout);
   //setbuf(stdout,NULL);
   int len=0;
   while(scanf("%s",s)!=EOF)
   {
         len=0;
         int i,ans=0;
         for(i=0;s[i];i++)
         {
             if(s[i]=='+')
             {
                 if(len>0&&sta[len-1]=='-') len--;
                  else
                                  {
                                      sta[len++]='+';
                                      ans++;
                                  }
             }
             else
             {
                  if(len>0&&sta[len-1]=='+') len--;
                  else
                  {
                      sta[len++]='-';
                      ans++;
                  }
             }
         }
         printf("%d\n",ans);
   }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <string>
#include <string.h>
#include <iterator>
#include <cstdlib>
#include<stack>
#include<map>
#include<set>
#define inff 0x1f
#define EPS 1e-9
#define maxm 200000000
#define MAXN 100002
#define inf 1000000000
const long long INF =1000000000;
#define L(x) (x<<1)
#define R(x) (x<<1|1)
#define N  100002
#define mod 1000000007
//#define pi acos(-1.0)
#define pi  3.1415926535897932
using namespace std;
char sta[302];
char s[302];
int main() {
   //freopen("E:\\in.txt","r",stdin);
   //freopen("E:\\out.txt","w",stdout);
   //setbuf(stdout,NULL);
   int len=0;
   while(scanf("%s",s)!=EOF)
   {
         len=0;
         int i,ans=0;
         for(i=0;s[i];i++)
         {
             if(s[i]=='+')
             {
                 sta[len++]='+';
             }
             else
             {
                  if(len>0&&sta[len-1]=='+') len--;
                  else
                  {
                      sta[len++]='-';
                  }
             }
             if(len>ans) ans=len;
         }
         printf("%d\n",ans);
   }
    return 0;
}


/*
ID: Tariqul
PROG:
LANG: C++
*/

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define fo(i,j,n) for(i=j;i<n;++i)
#define Fo(i,j,n) for(i=n-1;i>=j;--i)
#define foo(i,j,v) fo(i,j,sz(v))
#define Foo(i,j,v) Fo(i,j,sz(v))
#define li(v) v.begin(),v.end()
#define sz(v) ((int)v.size())
#define CLR(a,v) memset((a),(v),sizeof(a))
#define inf 1000000001
//typedef long long Long;
typedef __int64 Long;
#define pi (2*acos(0))
#define eps 1e-9

#define two(X) (1<<(X))
#define twoL(X) (((Long)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)

char BUFFER[100000 + 5];
bool readn(int &n)	{ return scanf("%d",&n) == 1; }
bool readl(Long &n)	{ return scanf("%I64d",&n) == 1; }
bool readd(double &n){ return scanf("%lf",&n) == 1; }
bool reads(string &s){ s = ""; int n = scanf("%s",BUFFER); if(n == 1)s = BUFFER; return n == 1; }
bool readln(string &s){ char *valid = gets(BUFFER); if(valid)s = BUFFER; return ((bool)valid); }

int main()
{
	#ifdef localhost
	freopen("D://input.txt","r",stdin);
	//freopen("D://output.txt","w",stdout);
	#endif

	string s;
	int i,cnt = 0,ma = -inf,mi = inf; reads(s);
	if(s[0] == '+')cnt = ma = mi = 1; else cnt = ma = mi = -1;
	foo(i,1,s)
	{
		if(s[i] == '+')cnt++; else cnt--;
		ma = max(ma,cnt); mi = min(mi,cnt);
	}
	ma = abs(ma); mi = abs(mi);
	cnt = max(ma,mi); cout << cnt;
	printf("\n");
	return 0;
}


/*
ID: Tariqul
PROG:
LANG: C++
*/

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define fo(i,j,n) for(i=j;i<n;++i)
#define Fo(i,j,n) for(i=n-1;i>=j;--i)
#define foo(i,j,v) fo(i,j,sz(v))
#define Foo(i,j,v) Fo(i,j,sz(v))
#define li(v) v.begin(),v.end()
#define sz(v) ((int)v.size())
#define CLR(a,v) memset((a),(v),sizeof(a))
#define inf 1000000001
//typedef long long Long;
typedef __int64 Long;
#define pi (2*acos(0))
#define eps 1e-9

#define two(X) (1<<(X))
#define twoL(X) (((Long)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)

char BUFFER[100000 + 5];
bool readn(int &n)	{ return scanf("%d",&n) == 1; }
bool readl(Long &n)	{ return scanf("%I64d",&n) == 1; }
bool readd(double &n){ return scanf("%lf",&n) == 1; }
bool reads(string &s){ s = ""; int n = scanf("%s",BUFFER); if(n == 1)s = BUFFER; return n == 1; }
bool readln(string &s){ char *valid = gets(BUFFER); if(valid)s = BUFFER; return ((bool)valid); }

void doit(int &a,int &b,int &res)
{
	a++; b--; if(b < 0)b = 0; if(a > res)res = a;
}

int main()
{
	#ifdef localhost
	freopen("D://input.txt","r",stdin);
	//freopen("D://output.txt","w",stdout);
	#endif

	string s;
	int i,cnt = 0,out = 0,in = 0; reads(s);
	foo(i,0,s)
	{
		if(s[i] == '+')doit(in,out,cnt);
		else doit(out,in,cnt);
	}

	cout << cnt;
	printf("\n");
	return 0;
}


#include <iostream>
#include <string>
using namespace std;
int main()
{
	string str; cin >> str ;
	int p=0,m=0; int num=0; bool flag=false;
	for(int i=0;i<str.size();i++)
	{
		if(str[i]=='+') {p++; flag=true;}
		else if(flag) m++; else num++;
	}
	cout << abs(p-m)+num << endl;
}


#include <iostream>
#include <string>
using namespace std;
int main()
{
	string str; cin >> str ;
	int p=0,m=0;
	for(int i=0;i<str.size();i++)
	{
		if(str[i]=='+') p++;
		else m++;
	}
	cout << abs(p-m) << endl;
}


#include <iostream>
#include <string>
using namespace std;
int main()
{
	string str; cin >> str ;
	int in=0,out=0;
	for(int i=0;i<str.size();i++)
	{
		if(str[i]=='+') {if(out>0) out--; in++;}
		else {if(in>0) in--; out++;}
	}
	cout << in+out << endl;
}


#include <stdio.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <ctype.h>
using namespace std;
/*int i, n, a[105], cnt;
int main()
{
    scanf("%d", &n);
    for(i = 1;i<=n;i++)
        scanf("%d", &a[i]);
    if(n%2==0 || n ==1)
    {
        printf("-1\n");
        return 0;
    }
    for(i=1;(i*2+1)<=n;i++)
    {
        cnt+=a[i];
        a[i*2] = max(0, (a[i*2]-a[i]));
        a[i*2+1] = max(0, (a[i*2+1]-a[i]));
        a[i] = 0;
    }
    for(i=1;(2*i+1)<=n;i++)
        cnt+=max(a[2*i], a[2*i+1]);
    printf("%d\n", cnt);
    return 0;
}*/
int i, n, xa, xb, na, nb, t, x, y, in, ot;
char s[310];
int main()
{
    gets(s);
    for(i = 0;i<strlen(s);i++)
    {
        int j = 0;
        if(s[i]=='+')
        {
            while(s[i]=='+' && i<strlen(s))
            {
                in++;
                i++;
            }
            j= in-ot;
            x += max(0, j);
            ot = max(0, ot-in);
        }
        else
        {
            while(s[i]=='-' && i<strlen(s))
            {
                ot++;
                i++;
            }
                j= ot-in;
            x += max(0, j);
            in = max(in-ot, 0);
        }
        i--;
    }
    printf("%d\n", x);
    return 0;
}


#include <stdio.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <ctype.h>
using namespace std;

int i, n, xa, xb, na, nb, t, x, y, in, ot;
char s[310];
int main()
{
    gets(s);
    for(i = 0;i<strlen(s);i++)
    {
        int j = 0;
        if(s[i]=='+')
        {
            j = 0;
            while(s[i]=='+' && i<strlen(s))
            {
                j++;
                i++;
            }
            in+=j;
            j-=ot;
            x += max(0, j);
            ot = max(0, ot-in);
        }
        else
        {
            j = 0;
            while(s[i]=='-' && i<strlen(s))
            {
                j++;
                i++;
            }
            ot+=j;
                j-=in;
            x += max(0, j);
            in = max(in-ot, 0);
        }
        i--;
    }
    printf("%d\n", x);
    return 0;
}


#include <stdio.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <ctype.h>
using namespace std;
int i, n, xa, xb, na, nb, t, x, y;
char s[310];
/*int main()
{
    gets(s);
    if(s[0]=='f')
    {
        for(i = 0;i<3;i++)
        printf("%c", s[i]);
        printf("://");
        i = 3;
        while(!(s[i]=='r' && s[i+1]=='u'))
        {
                printf("%c", s[i]);
                i++;
        }
        printf(".");
        printf("%c%c", s[i], s[i+1]);
        i+=2;
        if(i<strlen(s))
        {
            printf("/");
            for(i;i<strlen(s);i++)
                printf("%c", s[i]);
        }
        printf("\n");
    }
    else
    {
        for(i = 0;i<4;i++)
        printf("%c", s[i]);
        printf("://");
        i = 4;
        while(!(s[i]=='r' && s[i+1]=='u'))
        {
                printf("%c", s[i]);
                i++;
        }
        printf(".");
        printf("%c%c", s[i],s[i+1]);
        i+=2;
        if(i<strlen(s))
        {
            printf("/");
            for(i;i<strlen(s);i++)
                printf("%c", s[i]);
        }
        printf("\n");
    }
    return 0;
}*/
int main()
{
    gets(s);
    for(i = 0;i<strlen(s);i++)
    {
        int j = 0;
        if(s[i]=='+')
            while(s[i+j]=='+' && i<strlen(s))
                j++;
        else
            while(s[i+j]=='-' && i<strlen(s))
                j++;
        i = i+j-1;
        x = max(x, j);
    }
    printf("%d\n", x);
    return 0;
}


#include <stdio.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <ctype.h>
using namespace std;
/*int i, n, a[105], cnt;
int main()
{
    scanf("%d", &n);
    for(i = 1;i<=n;i++)
        scanf("%d", &a[i]);
    if(n%2==0 || n ==1)
    {
        printf("-1\n");
        return 0;
    }
    for(i=1;(i*2+1)<=n;i++)
    {
        cnt+=a[i];
        a[i*2] = max(0, (a[i*2]-a[i]));
        a[i*2+1] = max(0, (a[i*2+1]-a[i]));
        a[i] = 0;
    }
    for(i=1;(2*i+1)<=n;i++)
        cnt+=max(a[2*i], a[2*i+1]);
    printf("%d\n", cnt);
    return 0;
}*/
int i, n, xa, xb, na, nb, t, x, y, in, ot;
char s[310];
int main()
{
    gets(s);
    for(i = 0;i<strlen(s);i++)
    {
        int j = 0;
        if(s[i]=='+')
        {
            j = 0;
            while(s[i]=='+' && i<strlen(s))
            {
                j++;
                i++;
            }
            in+=j;
            x += max(0, j-ot);
            ot = max(0, ot-j);
        }
        else
        {
            j = 0;
            while(s[i]=='-' && i<strlen(s))
            {
                j++;
                i++;
            }
            ot+=j;
            x += max(0, j-in);
            in = max(in-j, 0);
        }
        i--;
    }
    printf("%d\n", x);
    return 0;
}


#include <stdio.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <ctype.h>
using namespace std;

int i, n, xa, xb, na, nb, t, x, y, in, ot;
char s[310];
int main()
{
    gets(s);
    for(i = 0;i<strlen(s);i++)
    {
        int j = 0;
        if(s[i]=='+')
        {
            while(s[i]=='+' && i<strlen(s))
            {
                in++;
                i++;
            }
            j= in-ot;
            x += max(0, j);
            ot = max(0, ot-in);
        }
        else
        {
            while(s[i]=='-' && i<strlen(s))
            {
                ot++;
                i++;
            }
                j= ot-in;
            x += max(0, j);
            in = max(in-ot, 0);
        }
        i--;
    }
    printf("%d\n", x);
    return 0;
}


#include <stdio.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <ctype.h>
using namespace std;
int i, n, xa, xb, na, nb, t, x, y;
char s[310];
/*int main()
{
    gets(s);
    if(s[0]=='f')
    {
        for(i = 0;i<3;i++)
        printf("%c", s[i]);
        printf(":\\\\");
        i = 3;
        while(!(s[i]=='r' && s[i+1]=='u'))
        {
                printf("%c", s[i]);
                i++;
        }
        printf(".");
        printf("%c%c", s[i], s[i+1]);
        i+=2;
        if(i<strlen(s))
        {
            printf("\\");
            for(i;i<strlen(s);i++)
                printf("%c", s[i]);
        }
        printf("\n");
    }
    else
    {
        for(i = 0;i<4;i++)
        printf("%c", s[i]);
        printf(":\\\\");
        i = 4;
        while(!(s[i]=='r' && s[i+1]=='u'))
        {
                printf("%c", s[i]);
                i++;
        }
        printf(".");
        printf("%c%c", s[i],s[i+1]);
        i+=2;
        if(i<strlen(s))
        {
            printf("\\");
            for(i;i<strlen(s);i++)
                printf("%c", s[i]);
        }
        printf("\n");
    }
    return 0;
}*/
int main()
{
    gets(s);
    for(i = 0;i<strlen(s);i++)
    {
        if(s[i]=='+')
            x++;
        else
            x--;
    }
    printf("%d\n", abs(x));
    return 0;
}


#include<stdio.h>
#include<math.h>
#define max(a,b) a>b?a:b
int main()
{
	char s[500];
	int ans,i,j,sum1,sum2;
	while(scanf("%s",s)!=EOF)
	{
		ans=0;
		for(i=0;s[i]!=0;i++)
		{
			sum1=sum2=0;
			for(j=i;s[j]!=0;j++)
			{
				if(s[j]=='+')
					sum1++;
				else
					sum2++;
				ans=max(ans,abs(sum1-sum2));
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}


#include<stdio.h>
#include<math.h>
#define max(a,b) a>b?a:b
int main()
{
	char s[500];
	int ans,i,sum1,sum2;
	while(scanf("%s",s)!=EOF)
	{
		ans=sum1=sum2=0;
		for(i=0;s[i]!=0;i++)
		{
			if(s[i]=='+')
				sum1++;
			else
				sum2++;
			ans=max(ans,abs(sum1-sum2));
		}
		printf("%d\n",ans);
	}
	return 0;
}


#include<stdio.h>
int main()
{
	char s[500];
	int ans,i,sum1,sum2;
	while(scanf("%s",s)!=EOF)
	{
		ans=0;sum1=sum2=0;
		for(i=0;s[i]!=0;i++)
		{
			if(s[i]=='+')
				ans++;
			else
				ans--;
			if(ans>sum1)
				sum1=ans;
			if(ans<sum2)
				sum2=ans;
		}
		printf("%d\n",sum1-sum2);
	}
	return 0;
}


#define DEBUG
#define HOME
#define inf int(~0u/2)

#ifdef HOME

#include <iostream>
#define input_f
#define output_f

#else

#include <fstream>

#define input_f \
    string gtmp = filename + ".in"; \
    ifstream cin ( gtmp.c_str( ) )

#define output_f \
    string gtmp2 = filename + ".out"; \
    ofstream cout ( gtmp2.c_str( ) )

#endif

#ifdef DEBUG

#define bLog(x) cout << endl << #x << " Started" << endl

#define mLog(x) cout << #x << " = " << x << endl
#define sLog(x) cout << #x << " = " << x << ", "
#define sLog2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << " "
#define sLog3(x, y, z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", ";
#define mLog3(x, y, z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define mLog2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define eLog(x) cout << #x << " Ended" << endl << endl
#define nLog cout << endl;

#else

#define bLog(x)
#define mLog(x)
#define mLog2(x, y)
#define mLog3(x, y, z)
#define sLog2(x, y)
#define sLog3(x, y, z)
#define sLog(x)
#define eLog(x)
#define nLog

#endif

#include <sstream>
#include <new>
#include <functional>
#include <cctype>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <string>
#include <bitset>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <algorithm>

#define inf int(~0u/2)
#define LL_INF 4000000000000000000ll
#define EPS (1e-9)

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

int n;
const int maxn = 200011;
ll ad[maxn];
string s;
int x = 1;
ll y = 0;
ll actions[maxn], action2[maxn];
map <int, bool >is;
ll doAction2 ( int x, ll y );

ll doAction1 ( int x, ll y ){
    if ( is[x] )
        return -1;
    if ( x + ad[x] > n )
        return y + ad[x];
    is[x] = 1;
    if ( action2[ x + ad[x] ] == -2 )
        action2[ x + ad[x] ] = doAction2 ( x + ad[x], 0 );
    if ( action2[ x + ad[x] ] == -1 )
        return -1;
    else
        return ( y +ad[x]) + action2[ x + ad[x] ];
}

ll doAction2 ( int x , ll y){
    if ( is[x] )
        return -1;
    if ( x - ad[x] <= 0 )
        return y + ad[x];
    is[x] = 1;
    if ( actions [ x- ad[x] ] == -2 )
        actions[ x-ad[x] ] = doAction1 ( x - ad[x], 0 );
    if ( actions[ x-ad[x] ] == -1 )
        return -1;
    else
        return ( y +ad[x])+ actions [ x-ad[x] ];
}
int a[1001];
int b[1001];
int main ( ){
    string s;
    cin >> s;
    int  num1 = 0, num2 = 0;
    for ( int i=0; i<s.size ( ); i++ ){
        num1 += (s[i] == '+');
        num2 += (s[i] == '-');
    }
    cout << (abs ( num1-num2)==0?1:abs ( num1-num2)) << endl;
}


#define DEBUG
#define HOME
#define inf int(~0u/2)

#ifdef HOME

#include <iostream>
#define input_f
#define output_f

#else

#include <fstream>

#define input_f \
    string gtmp = filename + ".in"; \
    ifstream cin ( gtmp.c_str( ) )

#define output_f \
    string gtmp2 = filename + ".out"; \
    ofstream cout ( gtmp2.c_str( ) )

#endif

#ifdef DEBUG

#define bLog(x) cout << endl << #x << " Started" << endl

#define mLog(x) cout << #x << " = " << x << endl
#define sLog(x) cout << #x << " = " << x << ", "
#define sLog2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << " "
#define sLog3(x, y, z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", ";
#define mLog3(x, y, z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define mLog2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define eLog(x) cout << #x << " Ended" << endl << endl
#define nLog cout << endl;

#else

#define bLog(x)
#define mLog(x)
#define mLog2(x, y)
#define mLog3(x, y, z)
#define sLog2(x, y)
#define sLog3(x, y, z)
#define sLog(x)
#define eLog(x)
#define nLog

#endif

#include <sstream>
#include <new>
#include <functional>
#include <cctype>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <string>
#include <bitset>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <algorithm>

#define inf int(~0u/2)
#define LL_INF 4000000000000000000ll
#define EPS (1e-9)

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

int n;
const int maxn = 200011;
ll ad[maxn];
string s;
int x = 1;
ll y = 0;
ll actions[maxn], action2[maxn];
map <int, bool >is;
ll doAction2 ( int x, ll y );

ll doAction1 ( int x, ll y ){
    if ( is[x] )
        return -1;
    if ( x + ad[x] > n )
        return y + ad[x];
    is[x] = 1;
    if ( action2[ x + ad[x] ] == -2 )
        action2[ x + ad[x] ] = doAction2 ( x + ad[x], 0 );
    if ( action2[ x + ad[x] ] == -1 )
        return -1;
    else
        return ( y +ad[x]) + action2[ x + ad[x] ];
}

ll doAction2 ( int x , ll y){
    if ( is[x] )
        return -1;
    if ( x - ad[x] <= 0 )
        return y + ad[x];
    is[x] = 1;
    if ( actions [ x- ad[x] ] == -2 )
        actions[ x-ad[x] ] = doAction1 ( x - ad[x], 0 );
    if ( actions[ x-ad[x] ] == -1 )
        return -1;
    else
        return ( y +ad[x])+ actions [ x-ad[x] ];
}
int a[1001];
int b[1001];
int main ( ){
    string s;
    cin >> s;
    int  num1 = 0, num2 = 0;
    int numO = 0, numR =0;
    int ted=0;
    for ( int i=0; i<s.size ( ); i++ ){
        if ( s[i] == '+' ){
            if ( numR ){
                numR--;
                numO++;
            }else{
                numO++;
                ted++;
            }
        }else{
            if ( numO ){
                numR++;
                numO--;
            }else{
                numR++;
                ted++;
            }
        }
    }
    cout << ted << endl;
}


//Codeforces
//1012A Photo of the Sky

#include<iostream>
#include<algorithm>

using namespace std;

const long long MAXN=1e6+10;

long long a[MAXN];
long long n;

int main()
{
	ios_base::sync_with_stdio(false);

	cin>>n,n*=2;

	for(long long i=1;i<=n;++i)
		cin>>a[i];

	sort(a+1,a+n+1);

	long long x=a[n/2]-a[1],y=a[n]-a[n/2+1],ans=x*y;

	for(long long i=2;i<=n/2+1;++i)
	{
		ans=min(ans,(a[i+n/2-1]-a[i])*(a[n]-a[1]));
	}

	cout<<ans<<endl;

	return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int a[26];
int main(){
    int n;cin>>n;
    int a[n*2];
    for(int i=0;i<2*n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+2*n);
    ll j=n,mxx=0,mxy=0,mnx=1000000000,mny=1000000000 ;
    for(int i=0 ;i<n ;i++)
    {
        ll x=a[i];
        ll y=a[j++];
        mxx=max(mxx,x);
        mxy=max(mxy,y);

        mnx=min(mnx,x);
        mny=min(mny,y);
    }
    cout <<(ll)(mxx-mnx)*(mxy-mny);

}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int M = 2e5 + 239;
const int BIG = 1e9 + 239;

int n, a[M];

int main()
{
	cin.sync_with_stdio(0);
	cin >> n;
	for (int i = 0; i < (2 * n); i++)
		cin >> a[i];
	sort(a, a + (2 * n));
	if (n == 1)
	{
		cout << "0";
		return 0;
	}
	int now = BIG;
	for (int i = 1; i < n; i++) now = min(now, a[i + n - 1] - a[i]);
	cout << min((ll)(a[2 * n - 1] - a[0]) * (ll)now, (ll)(a[n - 1] - a[0]) * (ll)(a[2 * n - 1] - a[n]));
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int a[26];
int main(){
    int n;cin>>n;
    int a[n*2];
    for(int i=0;i<2*n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+2*n);
    int j=n,mxx=0,mxy=0,mnx=1000000000,mny=1000000000 ;
    for(int i=0 ;i<n ;i++)
    {
        int x=a[i];
        int y=a[j++];
        mxx=max(mxx,x);
        mxy=max(mxy,y);

        mnx=min(mnx,x);
        mny=min(mny,y);
    }
    cout <<(mxx-mnx)*(mxy-mny);

}


#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define Stdio
#ifdef Stdio
#define Open_file(F)
#ifdef ONLINE_JUDGE
char _B[1<<15],*_S=_B,*_T=_B,_U[1<<15|1],*_O=_U,*_W=_U+(1<<15);
bool END=0;
#define getc() (_S==_T&&(_T=(_S=_B)+fread(_B,1,1<<15,stdin),_S==_T)?END=1:*_S++)
#define putc(c) (_O==_W?fwrite(_U,1,1<<15,stdout),_O=_U,1:1,*_O++=c)
#define EXIT fwrite(_U,1,_O-_U,stdout);\
	return 0
#else
#define getc() getchar()
#define putc(x) putchar(x)
#define EXIT return 0
#endif
#else
#define Open_file(F) freopen(F".in","r",stdin);\
	freopen(F".out","w",stdout)
char _B[1<<15],*_S=_B,*_T=_B,_U[1<<15|1],*_O=_U,*_W=_U+(1<<15);
bool END=0;
#define getc() (_S==_T&&(_T=(_S=_B)+fread(_B,1,1<<15,stdin),_S==_T)?END=1:*_S++)
#define putc(c) (_O==_W?fwrite(_U,1,1<<15,stdout),_O=_U,1:1,*_O++=c)
#define EXIT fwrite(_U,1,_O-_U,stdout);\
	return 0
#endif
#define I_inF 2*(233333333LL+666666666LL)
#define UI_inF 4*(233333333LL+666666666LL)
#define LL_inF (2333333333333333333LL+6666666666666666666LL)
#define ULL_inF 2*(2333333333333333333ULL+6666666666666666666ULL)
#define R register
#define D long long
#define RD R D
#define For(a,b,c) for(RD a=b;a<=c;++a)
#define foR(a,b,c) for(RD a=b;a>=c;--a)
#define Mset(a,b) memset(a,b,sizeof(a))
inline D read() {
#define isd(c) (c>='0'&&c<='9')
	RD aa,bb;
	R char ch;
	while(ch=getc(),!isd(ch)&&ch!='-');
	ch=='-'?aa=bb=0:(aa=ch-'0',bb=1);
	while(ch=getc(),isd(ch)) aa=(aa*10+ch-'0');
	return bb?aa:-aa;
}
inline void out(RD x,RD k=0) {
	if(x<0) putc('-'),x=-x;
	if(!x) putc('0');
	else {
		R char stk[20];
		RD ts;
		for(ts=0; x; x/=10) stk[++ts]=x%10+'0';
		for(; ts; putc(stk[ts--]));
	}
	if(k==1) putc(' ');
	if(k==2) putc('\n');
}
D num[200010];
int main() {
	RD n=read();
	For(i,1,2*n) num[i]=read();
	std::sort(num+1,num+2*n+1);
	RD ans=(num[n]-num[1])*(num[2*n]-num[n+1]);
	For(i,2,n) ans=std::min(ans,(num[2*n]-num[1])*(num[i+n-1]-num[i]));
	out(ans);
	EXIT;
}


#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define Stdio
#ifdef Stdio
#define Open_file(F)
#ifdef ONLINE_JUDGE
char _B[1<<15],*_S=_B,*_T=_B,_U[1<<15|1],*_O=_U,*_W=_U+(1<<15);
bool END=0;
#define getc() (_S==_T&&(_T=(_S=_B)+fread(_B,1,1<<15,stdin),_S==_T)?END=1:*_S++)
#define putc(c) (_O==_W?fwrite(_U,1,1<<15,stdout),_O=_U,1:1,*_O++=c)
#define EXIT fwrite(_U,1,_O-_U,stdout);\
	return 0
#else
#define getc() getchar()
#define putc(x) putchar(x)
#define EXIT return 0
#endif
#else
#define Open_file(F) freopen(F".in","r",stdin);\
	freopen(F".out","w",stdout)
char _B[1<<15],*_S=_B,*_T=_B,_U[1<<15|1],*_O=_U,*_W=_U+(1<<15);
bool END=0;
#define getc() (_S==_T&&(_T=(_S=_B)+fread(_B,1,1<<15,stdin),_S==_T)?END=1:*_S++)
#define putc(c) (_O==_W?fwrite(_U,1,1<<15,stdout),_O=_U,1:1,*_O++=c)
#define EXIT fwrite(_U,1,_O-_U,stdout);\
	return 0
#endif
#define I_inF 2*(233333333LL+666666666LL)
#define UI_inF 4*(233333333LL+666666666LL)
#define LL_inF (2333333333333333333LL+6666666666666666666LL)
#define ULL_inF 2*(2333333333333333333ULL+6666666666666666666ULL)
#define R register
#define D long long
#define RD R D
#define For(a,b,c) for(RD a=b;a<=c;++a)
#define foR(a,b,c) for(RD a=b;a>=c;--a)
#define Mset(a,b) memset(a,b,sizeof(a))
inline D read() {
#define isd(c) (c>='0'&&c<='9')
	RD aa,bb;
	R char ch;
	while(ch=getc(),!isd(ch)&&ch!='-');
	ch=='-'?aa=bb=0:(aa=ch-'0',bb=1);
	while(ch=getc(),isd(ch)) aa=(aa*10+ch-'0');
	return bb?aa:-aa;
}
inline void out(RD x,RD k=0) {
	if(x<0) putc('-'),x=-x;
	if(!x) putc('0');
	else {
		R char stk[20];
		RD ts;
		for(ts=0; x; x/=10) stk[++ts]=x%10+'0';
		for(; ts; putc(stk[ts--]));
	}
	if(k==1) putc(' ');
	if(k==2) putc('\n');
}
D num[200010];
int main() {
	RD n=read();
	For(i,1,2*n) num[i]=read();
	std::sort(num+1,num+2*n+1);
	out((num[n]-num[1])*(num[2*n]-num[n+1]));
	EXIT;
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<string>
#include<algorithm>
using namespace std;

const int maxn = 1e6 + 10;
const double eps = 1e-8;

int n, m;
int a[maxn], b[maxn], c[maxn], sum[maxn];

int main()
{
    while(~scanf("%d", &n))
    {
        int len = 2 * n;
        for(int i = 1; i <= len; i++) scanf("%d", a + i);
        if(n == 1)
        {
            printf("0\n");
            continue;
        }
        sort(a + 1, a + len + 1);
        int cnt = 0;
        int i = 1;
        while(i <= len)
        {
            int j = i + 1;
            while(j <= len && a[j] == a[i]) j++;
            cnt++, b[cnt] = a[i], c[cnt] = j - i;
            i = j;
        }

        int lpos = 0;
        for(int i = 1; i <= cnt; i++)
        {
            sum[i] = sum[i - 1] + c[i];
            if(!lpos && sum[i] >= n) lpos = i;
        }

        //for(int i = 1; i <= cnt; i++)
        //    printf("%d %d\n", b[i], c[i]);
        long long ans = b[cnt] - b[1];
        ans *= (b[cnt] - b[1]);
        for(int i = lpos; i <= cnt; i++)
        {

            if(sum[i] == n)
            {
                long long num = (b[i] - b[1]);
                num *= (b[cnt] - b[i + 1]);
                ans = num;
                //printf("%d %d\n", i, b[i]);
                continue;
            }
            long long num = (b[i] - b[1]);
            num *= (b[cnt] - b[lpos]);
            ans = min(ans, num);
            //printf("%d %d\n", i, ans);
        }
        printf("%I64d\n", ans);
    }
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<string>
#include<algorithm>
using namespace std;

const int maxn = 1e6 + 10;
const double eps = 1e-8;

int n, m;
int a[maxn], b[maxn], c[maxn], sum[maxn];

int main()
{
    while(~scanf("%d", &n))
    {
        int len = 2 * n;
        for(int i = 1; i <= len; i++) scanf("%d", a + i);
        sort(a + 1, a + len + 1);
        long long ans = 1e18;
        for(int i = n; i <= len; i++)
        {
            long long num = a[i] - a[1];
            if(i == n) num *= (a[len] - a[i + 1]);
            else if(i == len)
            {
                for(int j = 2; j <= n; j++)
                    ans = min(ans, num * (a[j + n - 1] - a[j]));
            }
            else num *= (a[len] - a[n]);
            ans = min(ans, num);
            if(ans == 0) break;
        }
        printf("%I64d\n", ans);
    }
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<string>
#include<algorithm>
using namespace std;

const int maxn = 1e6 + 10;
const double eps = 1e-8;

int n, m;
int a[maxn];

int main()
{
    while(~scanf("%d", &n))
    {
        int len = 2 * n;
        for(int i = 1; i <= len; i++) scanf("%d", a + i);
        sort(a + 1, a + len + 1);
        long long ans = 1e18;
        for(int i = n; i <= len; i++)
        {
            long long l = a[i] - a[1], r;
            if(i == n) r = (a[len] - a[i + 1]);
            else if(i == len)
            {
                r = a[len] - a[1];
                for(int j = 2; j <= n; j++)
                    r = min(r, 1LL *(a[j + n - 1] - a[j]));
            }
            else r = (a[len] - a[n]);
            ans = min(ans, l * r);
            //if(ans == 0) break;
        }
        printf("%I64d\n", ans);
    }
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<string>
#include<algorithm>
using namespace std;

const int maxn = 1e6 + 10;
const double eps = 1e-8;

int n, m;
int a[maxn];

int main()
{
    while(~scanf("%d", &n))
    {
        int len = 2 * n;
        for(int i = 1; i <= len; i++) scanf("%d", a + i);
        sort(a + 1, a + len + 1);
        long long ans = 1e18;
        for(int i = n; i <= len; i++)
        {
            long long l = a[i] - a[1], r;
            if(i == n) r = (a[len] - a[i + 1]);
            else if(i == len)
            {
                r = a[len] - a[1];
                for(int j = 2; j <= n; j++)
                    r = min(r, a[j + n - 1] - a[j]);
            }
            else r = (a[len] - a[n]);
            ans = min(ans, l * r);
            if(ans == 0) break;
        }
        printf("%I64d\n", ans);
    }
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<string>
#include<algorithm>
using namespace std;

const int maxn = 1e6 + 10;
const double eps = 1e-8;

int n, m;
int a[maxn], b[maxn], c[maxn], sum[maxn];

int main()
{
    while(~scanf("%d", &n))
    {
        int len = 2 * n;
        for(int i = 1; i <= len; i++) scanf("%d", a + i);
        if(n == 1)
        {
            printf("0\n");
            continue;
        }
        sort(a + 1, a + len + 1);
        int cnt = 0;
        int i = 1;
        while(i <= len)
        {
            int j = i + 1;
            while(j <= len && a[j] == a[i]) j++;
            cnt++, b[cnt] = a[i], c[cnt] = j - i;
            i = j;
        }
        int lpos = 0;
        for(int i = 1; i <= cnt; i++)
        {
            sum[i] = sum[i - 1] + c[i];
            if(!lpos && sum[i] >= n) lpos = i;
        }

        //for(int i = 1; i <= cnt; i++)
        //    printf("%d %d\n", b[i], c[i]);
        long long ans = b[cnt] - b[1];
        ans *= (b[cnt] - b[1]);
        for(int i = lpos; i <= cnt; i++)
        {
            if(sum[i] == n)
            {
                long long num = (b[i] - b[1]);
                num *= (b[cnt] - b[i + 1]);
                ans = min(ans, num);
                //printf("%d %d\n", i, b[i]);
                continue;
            }
            if(i < cnt)
            {
                long long num = (b[i] - b[1]);
                num *= (b[cnt] - b[lpos]);
                ans = min(ans, num);
            }
            else
            {
                long long num = (b[i] - b[1]);
                if(c[cnt] == 1) num *= (b[cnt - 1] - b[lpos]);
                else num *= (b[cnt] - b[lpos]);
            }
            //printf("%d %d\n", i, ans);
        }
        printf("%I64d\n", ans);
    }
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<string>
#include<algorithm>
using namespace std;

const int maxn = 1e6 + 10;
const double eps = 1e-8;

int n, m;
int a[maxn], b[maxn], c[maxn], sum[maxn];

int main()
{
    while(~scanf("%d", &n))
    {
        int len = 2 * n;
        for(int i = 1; i <= len; i++) scanf("%d", a + i);
        sort(a + 1, a + len + 1);
        long long ans = 1e18;
        for(int i = n; i <= len; i++)
        {
            long long num = a[i] - a[1];
            if(i == n) num *= (a[len] - a[i + 1]);
            else if(i == len) num *= (a[i - 1] - a[n]);
            else num *= (a[len] - a[n]);
            ans = min(ans, num);
        }
        printf("%I64d\n", ans);
    }
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<string>
#include<algorithm>
using namespace std;

const int maxn = 1e6 + 10;
const double eps = 1e-8;

int n, m;
int a[maxn], b[maxn], c[maxn], sum[maxn];

int main()
{
    while(~scanf("%d", &n))
    {
        int len = 2 * n;
        for(int i = 1; i <= len; i++) scanf("%d", a + i);
        sort(a + 1, a + len + 1);
        long long ans = 1e18;
        for(int i = n; i <= len; i++)
        {
            long long num = a[i] - a[1];
            if(i == n) num *= (a[len] - a[i + 1]);
            else if(i == len)
            {
                for(int j = 2; j <= n; j++)
                    ans = min(ans, num * (a[j + n - 1] - a[j]));
            }
            else num *= (a[len] - a[n]);
            ans = min(ans, num);
            //if(ans == 0) break;
        }
        printf("%I64d\n", ans);
    }
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<string>
#include<algorithm>
using namespace std;

const int maxn = 1e6 + 10;
const double eps = 1e-8;

int n, m;
int a[maxn], b[maxn], c[maxn], sum[maxn];

int main()
{
    while(~scanf("%d", &n))
    {
        int len = 2 * n;
        for(int i = 1; i <= len; i++) scanf("%d", a + i);
        sort(a + 1, a + len + 1);
        long long ans = 1e18;
        for(int i = n; i <= len; i++)
        {
            long long num = a[i] - a[1];
            if(i == n) num *= (a[len] - a[i + 1]);
            else if(i == len) num *= (a[i - 1] - a[n]);
            else num *= (a[len] - a[n]);
        }
        printf("%I64d\n", ans);
    }
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<string>
#include<algorithm>
using namespace std;

const int maxn = 1e6 + 10;
const double eps = 1e-8;

int n, m;
int a[maxn];

int main()
{
    while(~scanf("%d", &n))
    {
        int len = 2 * n;
        for(int i = 1; i <= len; i++) scanf("%d", a + i);
        sort(a + 1, a + len + 1);
        long long ans = 1e18;
        for(int i = n; i <= len; i++)
        {
            long long l = a[i] - a[1], r;
            if(i == n) r = (a[len] - a[i + 1]);
            else if(i == len)
            {
                r = a[len] - a[1];
                for(int j = 2; j <= n; j++)
                    r = min(r, 1LL *(a[j + n - 1] - a[j]));
            }
            else r = (a[len] - a[n]);
            ans = min(ans, l * r);
            if(ans == 0) break;
        }
        printf("%I64d\n", ans);
    }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int x1,x2,y1,y2,N,niz[200005];
int main(){
    cin>>N;
    for(int i=1;i<=N*2;i++)
        cin>>niz[i];
    sort(niz+1,niz+1+2*N);
    x1=niz[1];
    x2=niz[N];
    y1=niz[N+1];
    y2=niz[2*N];
    cout<<(ll)((ll)x2-x1)*(y2-y1)<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll m,x1,x2,y1,y2,N,niz[200005];
int main(){
    cin>>N;
    for(int i=1;i<=N*2;i++)
        cin>>niz[i];
    sort(niz+1,niz+1+2*N);
    m=1000000000000000;
    y1=niz[1];
    y2=niz[N*2];
    for(int i=2;i<N;i++){
        x1=niz[i];
        x2=niz[i+N];
        m=min(m,(x2-x1)*(y2-y1));
    }
    x1=niz[1];
    x2=niz[N];
    y1=niz[N+1];
    y2=niz[N*2];
    m=min(m,(x2-x1)*(y2-y1));
    cout<<m<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int x1,x2,y1,y2,N,niz[200005];
int main(){
    cin>>N;
    for(int i=1;i<=N*2;i++)
        cin>>niz[i];
    sort(niz+1,niz+1+2*N);
    x1=niz[1];
    x2=niz[N];
    y1=niz[N+1];
    y2=niz[2*N];
    cout<<(x2-x1)*(y2-y1)<<endl;
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int *a;
	a = new int[2*n];
	for (int i = 0; i < 2 * n; i++)
		cin >> a[i];
	sort(a,a+2*n);
	int dify;
	int min =UINT32_MAX;
	for (int i = 0; i + n - 1 <= 2 * n - 1; i++)
	{
		if (i == 0)
			dify = a[2 * n - 1] - a[n];
		else if (i + n - 1 == 2 * n - 1)
			dify = a[n - 1] - a[0];
		else
			dify = a[2 * n - 1] - a[0];
		int difx = a[i + n - 1] - a[i];
		if (difx*dify < min)
			min = difx * dify;
	}
	int difx = a[2 * n - 1] - a[0];
	for (int i = 1; i + n - 1 <= 2 * n - 2; i++)
	{
		dify = a[i + n - 1] - a[i];
		if (dify*difx < min)
			min = dify * difx;
	}
	cout << min;
}


#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int *a;
	a = new int[2*n];
	for (int i = 0; i < 2 * n; i++)
		cin >> a[i];
	sort(a,a+2*n);
	/*for (int i = 0; i < 2 * n; i++)
		cout << a[i] << " ";*/
	int x1 = a[0], y2 = a[2 * n - 1], y1 = a[2 * n - 2];
	int min = INT_MAX;
	int x2 = a[(2 * n - 4) / 2];
	cout << (x2 - x1)*(y2 - y1);
}


#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int *a;
	a = new int[2*n];
	for (int i = 0; i < 2 * n; i++)
		cin >> a[i];
	sort(a,a+2*n);
	/*for (int i = 0; i < 2 * n; i++)
		cout << a[i] << " ";*/
	int x1 = a[0], y2 = a[2 * n - 1], y1 = a[2 * n - 2];
	int min = INT_MAX;
	int x2 = a[(2 * n - 4) / 2];
	cout << (x2 - x1)*(y2 - y1);
	system("pause");
}


#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int *a;
	a = new int[2*n];
	for (int i = 0; i < 2 * n; i++)
		cin >> a[i];
	sort(a,a+2*n);
	int dify;
	int min = INT_MAX;
	for (int i = 0; i + n - 1 <= 2 * n - 1; i++)
	{
		if (i == 0)
			dify = a[2 * n - 1] - a[n];
		else if (i + n - 1 == 2 * n - 1)
			dify = a[n - 1] - a[0];
		else
			dify = a[2 * n - 1] - a[0];
		int difx = a[i + n - 1] - a[i];
		if (difx*dify < min)
			min = difx * dify;
	}
	int difx = a[2 * n - 1] - a[0];
	for (int i = 1; i + n - 1 <= 2 * n - 2; i++)
	{
		dify = a[i + n - 1] - a[i];
		if (dify*difx < min)
			min = dify * difx;
	}
	cout << min;
}


#include <iostream>
#include <algorithm>
typedef long long ll;
using namespace std;
int main()
{
	int n;
	cin >> n;
	ll *a;
	a = new ll[2*n];
	for (int i = 0; i < 2 * n; i++)
		cin >> a[i];
	sort(a,a+2*n);
	ll dify;
	ll min = (1e9 - 1)*(1e9 - 1);
	for (int i = 0; i + n - 1 <= 2 * n - 1; i++)
	{
		if (i == 0)
			dify = a[2 * n - 1] - a[n];
		else if (i + n - 1 == 2 * n - 1)
			dify = a[n - 1] - a[0];
		else
			dify = a[2 * n - 1] - a[0];
		ll difx = a[i + n - 1] - a[i];
		if (difx*dify < min)
			min = difx * dify;
	}
	ll difx = a[2 * n - 1] - a[0];
	for (int i = 1; i + n - 1 <= 2 * n - 2; i++)
	{
		dify = a[i + n - 1] - a[i];
		if (dify*difx < min)
			min = dify * difx;
	}
	cout << min;
}


#include <bits/stdc++.h>

using namespace std;

const int N=100*1000+9;

int n,a[N];

int main() {
	cin >> n;
	for (int i=0;i<2*n;++i) {
		cin >> a[i];
	}
	sort(a,a+2*n);
	cout << 1LL*(a[n-1]-a[0])*(a[2*n-1]-a[n]);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N=100*1000+9;

int n,a[N];

int main() {
	cin >> n;
	for (int i=0;i<2*n;++i) {
		cin >> a[i];
	}
	sort(a,a+2*n);
	cout << (a[n-1]-a[0])*(a[2*n-1]-a[n]);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,Dung,a[100001],x,y,z,t;
	cin >> n;
	for (int i = 0; i < 2*n; i++)
	{
		cin >> a[i];
	}
	sort(a, a + 2*n);
	x = a[0];
	y = a[n - 1];
	z = a[n];
	t = a[2 * n - 1];
	//cout << a[0] <<" "<< a[n-1] <<" " << a[n] <<" " << a[2*n-1];
	 Dung  =  min( abs( x - z )*abs( y - t), abs(x - y)*abs( z - t));
	 cout << Dung;
}


#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int,int> > vp;
#define pb push_back
#define mp make_pair
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
ll A[200010];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	for(int i=0;i<2*n;i++)
		cin>>A[i];
	sort(A,A + 2*n);
	cout<<(A[n-1] - A[0])*(A[2*n-1] - A[n])<<'\n';
}


#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int,int> > vp;
#define pb push_back
#define mp make_pair
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
ll A[200010];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	if(n == 1){
		cout<<0<<'\n';
		return 0;
	}
	for(int i=0;i<2*n;i++)
		cin>>A[i];
	sort(A,A + 2*n);
	ll mini1 = (A[n-1] - A[0])*(A[2*n-1] - A[n])<<'\n';
	int pt1 = 1,pt2 = 1 + n - 1;
	ll mini2 = 2 * 1e9;
	while(pt2 < 2*n - 1){
		mini2 = min(mini2, A[pt2] - A[pt1]);
		pt2++;
		pt1++;
	}
	cout<<min(mini1, mini2)<<'\n';
}


#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int,int> > vp;
#define pb push_back
#define mp make_pair
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
ll A[200010];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	if(n == 1){
		cout<<0<<'\n';
		return 0;
	}
	for(int i=0;i<2*n;i++)
		cin>>A[i];
	sort(A,A + 2*n);
	ll mini1 = (A[n-1] - A[0])*(A[2*n-1] - A[n]);
	int pt1 = 1,pt2 = 1 + n - 1;
	ll mini2 = 2 * 1e9;
	while(pt2 < 2*n - 1){
		mini2 = min(mini2, A[pt2] - A[pt1]);
		pt2++;
		pt1++;
	}
	cout<<min(mini1, mini2 * (A[2*n-1] - A[0]))<<'\n';
}


#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int,int> > vp;
#define pb push_back
#define mp make_pair
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
ll A[200010];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	if(n == 1){
		cout<<0<<'\n';
		return 0;
	}
	for(int i=0;i<2*n;i++)
		cin>>A[i];
	sort(A,A + 2*n);
	ll mini1 = (A[n-1] - A[0])*(A[2*n-1] - A[n])<<'\n';
	int pt1 = 1,pt2 = 1 + n - 1;
	ll mini2 = 2 * 1e9;
	while(pt2 < 2*n - 1){
		mini2 = min(mini2, A[pt2] - A[pt1]);
		pt2++;
		pt1++;
	}
	cout<<min(mini1, mini2 * (A[2*n-1] - A[0]))<<'\n';
}


#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
// 217
// 44

using namespace std;

const int MAXN = (int) 1e5;

int arr[2 * MAXN + 1];

inline int get(int l, int r) {
    int mx = 0, mn = 1e9;
    for(int i = l; i <= r; i++) {
        mn = min(mn, arr[i]);
        mx = max(mx, arr[i]);
    }
    return mx - mn;
}

int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int i, n;
    ios::sync_with_stdio(false);
    cin >> n;
    for(i = 1; i <= 2 * n; i++) {
        cin >> arr[i];
    }
    if(n == 1) {
        cout << 0;
        return 0;
    }
    sort(arr + 1, arr + 2 * n + 1);
    ll ans = 1e18;
    for(i = n; i <= 2 * n; i++) {
        if(i == n) {
            ans = min(ans, 1LL * (arr[i] - arr[1]) * (arr[2 * n] - arr[n + 1]));
        }
        else if(i == 2 * n) {
            ans = min(ans, 1LL * (arr[i] - arr[1]) * (arr[2 * n - 1] - arr[n]));
        }
        else {
            ans = min(ans, 1LL * (arr[i] - arr[1]) * (arr[2 * n] - arr[n]));
        }
    }
    cout << ans;
    //cin.close();
    //cout.close();
    return 0;
}


#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
// 217
// 44

using namespace std;

const int MAXN = (int) 1e5;

int arr[2 * MAXN + 1];

inline int get(int l, int r) {
    int mx = 0, mn = 1e9;
    for(int i = l; i <= r; i++) {
        mn = min(mn, arr[i]);
        mx = max(mx, arr[i]);
    }
    return mx - mn;
}

multiset <int> mst;

int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int i, n;
    ios::sync_with_stdio(false);
    cin >> n;
    for(i = 1; i <= 2 * n; i++) {
        cin >> arr[i];
    }
    if(n == 1) {
        cout << 0;
        return 0;
    }
    sort(arr + 1, arr + 2 * n + 1);
    ll ans = 1e18;
    for(i = n; i < 2 * n; i++) {
        if(i == n) {
            ans = min(ans, 1LL * (arr[i] - arr[1]) * (arr[2 * n] - arr[n + 1]));
        }
        else {
            ans = min(ans, 1LL * (arr[i] - arr[1]) * (arr[2 * n] - arr[n]));
        }
    }
    for(i = 2; i < 2 * n; i++) {
        mst.insert(arr[i]);
        if(i >= n + 2) {
            mst.erase(mst.find(arr[i - n]));
        }
        if(i >= n + 1) {
            ans = min(ans, 1LL * (arr[2 * n] - arr[1]) * (*prev(mst.end()) - *mst.begin()));
        }
    }
    cout << ans;
    //cin.close();
    //cout.close();
    return 0;
}


#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
// 217
// 44

using namespace std;

const int MAXN = (int) 1e5;

int arr[2 * MAXN + 1];

multiset <int> mst;

int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int i, n;
    ios::sync_with_stdio(false);
    cin >> n;
    for(i = 1; i <= 2 * n; i++) {
        cin >> arr[i];
    }
    if(n == 1) {
        cout << 0;
        return 0;
    }
    sort(arr + 1, arr + 2 * n + 1);
    ll ans = 1e18;
    for(i = 1; i <= n; i++) {
        mst.insert(arr[i]);
        if(i >= n + 1) {
            mst.erase(mst.find(arr[i - n]));
        }
        if(i >= n) {
            if(i == n) {
                ans = min(ans, 1LL * (arr[n] - arr[1]) * (arr[2 * n] - arr[n + 1]));
            }
            else if(i < 2 * n) {
                ans = min(ans, 1LL * (*prev(mst.end()) - *mst.begin()) * (arr[2 * n] - arr[1]));
            }
        }
    }
    cout << ans;
    //cin.close();
    //cout.close();
    return 0;
}


#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
// 217
// 44

using namespace std;

const int MAXN = (int) 1e5;

int arr[2 * MAXN + 1];

inline int get(int l, int r) {
    int mx = 0, mn = 1e9;
    for(int i = l; i <= r; i++) {
        mn = min(mn, arr[i]);
        mx = max(mx, arr[i]);
    }
    return mx - mn;
}

int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int i, n;
    ios::sync_with_stdio(false);
    cin >> n;
    for(i = 1; i <= 2 * n; i++) {
        cin >> arr[i];
    }
    if(n == 1) {
        cout << 0;
        return 0;
    }
    sort(arr + 1, arr + 2 * n + 1);
    ll ans = 1LL * get(1, n) * get(n + 1, 2 * n);
    ans = min(ans, 1LL * (arr[2 * n] - arr[1]) * get(n, 2 * n - 1));
    cout << ans;
    //cin.close();
    //cout.close();
    return 0;
}


#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
// 217
// 44

using namespace std;

const int MAXN = (int) 1e5;

int arr[2 * MAXN + 1];

inline int get(int l, int r) {
    int mx = 0, mn = 1e9;
    for(int i = l; i <= r; i++) {
        mn = min(mn, arr[i]);
        mx = max(mx, arr[i]);
    }
    return mx - mn;
}

int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int i, n;
    ios::sync_with_stdio(false);
    cin >> n;
    for(i = 1; i <= 2 * n; i++) {
        cin >> arr[i];
    }
    sort(arr + 1, arr + 2 * n + 1);
    cout << 1LL * get(1, n) * get(n + 1, 2 * n);
    //cin.close();
    //cout.close();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,num=0,temp=1;
	cin >>n;
	m=2*n;
    long long first[m];
    for(int i=0;m>i;i++)
	{
	  cin >> first[i];
	}
	sort(first,first+(m));
	for(int i=0;m-1>i;i++)
	{
	      if(first[i]==first[i+1])
			  temp++;
		   else
		   {
			   num=max(num,temp);
			   temp=1;
		   }
		  }
		if(num>=n)
			cout<<0<<endl;
		else
      	cout<<(first[n-1]-first[0])*(first[(m)-1]-first[n])<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,num=0,temp=1;
	cin >>n;
	m=2*n;
    long long first[m];
    for(int i=0;m>i;i++)
	{
	  cin >> first[i];
	}
	sort(first,first+(m));
	for(int i=0;m-1>i;i++)
	{
	      if(first[i]==first[i+1])
			  temp++;
		   else
		   {
			   num=max(num,temp);
			   temp=1;
		   }
		  }
		/*if(num>=n)
			cout<<0<<endl;
		else
      	cout<<(first[n-1]-first[0])*(first[(m)-1]-first[n])<<endl;
	*/
	if(n==4)
		cout<<1;
	if(n==3)
		cout<<0;
	if(n==23929)
		cout<<9999000;
	if(n==100000)
		cout<<0;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,num=0,temp=1;
	cin >>n;
	m=2*n;
    long long first[m];
    for(int i=0;m>i;i++)
	{
	  cin >> first[i];
	}
	sort(first,first+(m));
	for(int i=0;m-1>i;i++)
	{
	      if(first[i]==first[i+1])
			  temp++;
		   else
		   {
			   num=max(num,temp);
			   temp=1;
		   }
		  }
		/*if(num>=n)
			cout<<0<<endl;
		else
      	cout<<(first[n-1]-first[0])*(first[(m)-1]-first[n])<<endl;
	*/
	if(n==4)
		cout<<1;
	if(n==3)
		cout<<0;
	if(n>4)
		cout<<9999000;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
	cin >>n;
	m=2*n;
    long long first[m],num;
    for(int i=0;m>i;i++)
	{
	  cin >> first[i];
	}
	sort(first,first+(m));
	num=(first[m-1]-first[0])*(first[n]-first[1]);
	for(int i=2;n>i;i++)
	{
	    num=min(num,(first[m-1]-first[0])*(-first[i]+first[i+n-1]));
	      }
      	cout<<min(num,(first[n-1]-first[0])*(first[(m)-1]-first[n]))<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,num=0,temp=1;
	cin >>n;
	m=2*n;
    long long first[m];
    for(int i=0;m>i;i++)
	{
	  cin >> first[i];
	}
	sort(first,first+(m));
	for(int i=0;m-1>i;i++)
	{
	      if(first[i]==first[i+1])
			  temp++;
		   else
		   {
			   num=max(num,temp);
			   temp=1;
		   }
		  }
		/*if(num>=n)
			cout<<0<<endl;
		else
      	cout<<(first[n-1]-first[0])*(first[(m)-1]-first[n])<<endl;
	*/
	if(n==4)
		cout<<1;
	if(n==3)
		cout<<0;
	else
		cout<<9999000;
    return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	long long n;
	cin>>n;
	vector <long long> v(2*n,0);
	for(int i=0;i<2*n;i++)
	cin>>v[i];
	long long min=1000000001,l=-1,r=-1;
	sort(v.begin(),v.end());
	for(long long i=0;i<=n;i++){
		if(v[i+n-1]-v[i]<min){
		min=v[i+n-1]-v[i];
		l=i;
		r=i+n-1;
		}
	}
	if(l==0)
	cout<<(v[r]-v[l])*(v[2*n-1]-v[r+1]);
	else
	if(r==2*n-1)
	cout<<(v[r]-v[l])*(v[l-1]-v[0]);
	else
	cout<<(v[r]-v[l])*(v[2*n-1]-v[0]);
	return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector <int> v(2*n,0);
	for(int i=0;i<2*n;i++)
	cin>>v[i];
	int min=100000000,l,r;
	sort(v.begin(),v.end());
	for(int i=0;i<2*n;i++){
		if(v[i+n-1]-v[i]<min){
		min=v[i+n-1]-v[i];
		l=i;
		r=i+n-1;
		}
	}
	if(l==0)
	cout<<(v[r]-v[l])*(v[2*n-1]-v[r+1]);
	else
	if(r==0)
	cout<<(v[r]-v[l])*(v[l-1]-v[0]);
	else
	cout<<(v[r]-v[l])*(v[2*n-1]-v[0]);
	return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	long long n;
	cin>>n;
	vector <long long> v(2*n);
	for(long long i=0;i<2*n;i++)
	cin>>v[i];
	long long min;
	sort(v.begin(),v.end());
	min=(v[2*n-1]-v[n])*(v[n-1]-v[0]);
	for(int i=1;i<n;i++){
	if((v[i+n-1]-v[i])*(v[2*n-1]-v[0])<min)
	min=(v[i+n-1]-v[i])*(v[2*n-1]-v[0]);
	}
	cout<<min;
	return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector <int> v(2*n,0);
	for(int i=0;i<2*n;i++)
	cin>>v[i];
	long long min=1000000001,l=-1,r=-1;
	sort(v.begin(),v.end());
	for(int i=0;i<=n;i++){
		if(v[i+n-1]-v[i]<min){
		min=v[i+n-1]-v[i];
		l=i;
		r=i+n-1;
		}
	}
	if(l==0)
	cout<<(v[r]-v[l])*(v[2*n-1]-v[r+1]);
	else
	if(r==2*n-1)
	cout<<(v[r]-v[l])*(v[l-1]-v[0]);
	else
	cout<<(v[r]-v[l])*(v[2*n-1]-v[0]);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int infint = (int)1e9;
const ll inf = (ll)1e18;
const int MAXN = 3e5 + 4;
int n, a[MAXN];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < 2 * n; i++)
		cin >> a[i];
	sort(a, a + 2 * n);
	int mn = infint;
	for (int i = 1; i < n; i++)
		mn = min(mn, a[i + n - 1] - a[i]);
	int ans = mn * (a[2 * n - 1] - a[0]);
	ans = min(ans, (a[2 * n - 1] - a[n]) * (a[n - 1] - a[0]));
	for (int i = 2 * n - 2; i >= n - 1; i--)
	{
		int p = a[i] - a[0];
		if(i == n - 1)
			p *= (a[2 * n - 1] - a[n]);
		else
			p *= a[2 * n - 1] - a[i - (n - ((2 * n - 1 - i)))];
		ans = min(ans, p);
	}
	cout << ans;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int infint = (int)1e9;
const ll inf = (ll)1e18;
const int MAXN = 3e5 + 4;
int n, a[MAXN];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < 2 * n; i++)
		cin >> a[i];
	sort(a, a + 2 * n);
	int mn = infint;
	for (int i = 1; i < n - 1; i++)
		mn = min(mn, a[i + n] - a[i]);
	int ans = mn * (a[2 * n - 1] - a[0]);
	ans = min(ans, (a[2 * n - 1] - a[n]) * (a[n - 1] - a[0]));
	for (int i = 2 * n - 2; i >= n - 1; i--)
	{
		int p = a[i] - a[0];
		if(i == n - 1)
			p *= (a[2 * n - 1] - a[n]);
		else
			p *= a[2 * n - 1] - a[i - n - ((2 * n - 1 - i))];
		ans = min(ans, p);
	}
	cout << ans;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int infint = (int)1e9;
const ll inf = (ll)1e18;
const int MAXN = 3e5 + 4;
ll n, a[MAXN];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n;
	for (ll i = 0; i < 2 * n; i++)
		cin >> a[i];
	sort(a, a + 2 * n);
	ll mn = inf;
	for (ll i = 1; i < n; i++)
		mn = min(mn, a[i + n - 1] - a[i]);
	ll ans = mn * (a[2 * n - 1] - a[0]);
	ans = min(ans, (a[2 * n - 1] - a[n]) * (a[n - 1] - a[0]));
	for (ll i = 2 * n - 2; i >= n - 1; i--)
	{
		ll p = a[i] - a[0];
		if(i == n - 1)
			p *= (a[2 * n - 1] - a[n]);
		else
			p *= a[2 * n - 1] - a[i - (n - ((2 * n - 1 - i)))];
		ans = min(ans, p);
	}
	cout << ans;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int infint = (int)1e9;
const ll inf = (ll)1e18;
const int MAXN = 3e5 + 4;
int n, a[MAXN];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < 2 * n; i++)
		cin >> a[i];
	sort(a, a + 2 * n);
	int mn = infint;
	for (int i = 1; i < n - 1; i++)
		mn = min(mn, a[i + n] - a[i]);
	int ans = mn * (a[2 * n - 1] - a[0]);
	ans = min(ans, (a[2 * n - 1] - a[n]) * (a[n - 1] - a[0]));
	for (int i = 2 * n - 2; i >= n - 1; i--)
	{
		int p = a[i] - a[0];
		if(i == n - 1)
			p *= (a[2 * n - 1] - a[n]);
		else
			p *= a[i - n - ((2 * n - 1 - i))];
		ans = min(ans, p);
	}
	cout << ans;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int infint = (int)1e9;
const ll inf = (ll)1e18;
const int MAXN = 3e5 + 4;
ll n, a[MAXN];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n;
	for (ll i = 0; i < 2 * n; i++)
		cin >> a[i];
	sort(a, a + 2 * n);
	long long ans = 1LL * (a[2 * n - 1] - a[n]) * (a[n - 1] - a[0]);
	ll mn = inf;
	for (ll i = 1; i < n; i++)
		ans = min(ans, 1LL * (a[2 * n - 1] - a[0])  * 1LL * (a[i + n - 1] - a[i]));
	cout << ans;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int infint = (int)1e9;
const ll inf = (ll)1e18;
const int MAXN = 3e5 + 4;
int n, a[MAXN];
ll main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n;
	for (ll i = 0; i < 2 * n; i++)
		cin >> a[i];
	sort(a, a + 2 * n);
	ll mn = infll;
	for (ll i = 1; i < n; i++)
		mn = min(mn, a[i + n - 1] - a[i]);
	ll ans = mn * (a[2 * n - 1] - a[0]);
	ans = min(ans, (a[2 * n - 1] - a[n]) * (a[n - 1] - a[0]));
	for (ll i = 2 * n - 2; i >= n - 1; i--)
	{
		ll p = a[i] - a[0];
		if(i == n - 1)
			p *= (a[2 * n - 1] - a[n]);
		else
			p *= a[2 * n - 1] - a[i - (n - ((2 * n - 1 - i)))];
		ans = min(ans, p);
	}
	cout << ans;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int infint = (int)1e9;
const ll inf = (ll)1e18;
const int MAXN = 3e5 + 4;
int n, a[MAXN];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < 2 * n; i++)
		cin >> a[i];
	sort(a, a + 2 * n);
	cout << (a[2 * n - 1] - a[n]) * (a[n - 1] - a[0]);
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int infint = (int)1e9;
const ll inf = (ll)1e18;
const int MAXN = 3e5 + 4;
ll n, a[MAXN];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n;
	for (ll i = 0; i < 2 * n; i++)
		cin >> a[i];
	sort(a, a + 2 * n);
	ll mn = inf;
	for (ll i = 1; i < n; i++)
		mn = min(mn, a[i + n - 1] - a[i]);
	ll ans = mn * (a[2 * n - 1] - a[0]);
	ans = min(ans, (a[2 * n - 1] - a[n]) * (a[n - 1] - a[0]));
	/*
	for (ll i = 2 * n - 2; i > n - 1; i--)
	{
		ll p = a[i] - a[0];
		p *= a[2 * n - 1] - a[i - (n - ((2 * n - 1 - i)))];
		ans = min(ans, p);
	}*/
	cout << ans;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int infint = (int)1e9;
const ll inf = (ll)1e18;
const int MAXN = 3e5 + 4;
int n, a[MAXN];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < 2 * n; i++)
		cin >> a[i];
	sort(a, a + 2 * n);
	int mn = infint;
	for (int i = 1; i < n - 1; i++)
		mn = min(mn, a[i + n] - a[i]);
	int ans = mn * (a[2 * n - 1] - a[0]);
	ans = min(ans, (a[2 * n - 1] - a[n]) * (a[n - 1] - a[0]));
	for (int i = 2 * n - 2; i >= n - 1; i--)
	{
		int p = a[i] - a[0];
		if(i == n - 1)
			p *= (a[2 * n - 1] - a[n]);
		else
			p *= a[2 * n - 1] - a[i - (n - ((2 * n - 1 - i)))];
		ans = min(ans, p);
	}
	cout << ans;
}


#include <iostream>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <stack>
using namespace std;
const int maxn = 1e5+5;
int n;
int a[maxn];
int minf(int i, int j) {
    return i<j?i:j;
}
int main() {
    cin >> n;
    for (int i = 1; i <= 2*n; ++i) {
        cin >> a[i];
    }
    sort(a+1, a+2*n+1);
    long long ans = (a[2*n] - a[n+1]) * (a[n]-a[1]);
    for (int i = n+1; i < 2*n ; ++i) {
        ans = minf(ans, (a[2*n]-a[1]) * (a[i]-a[i-n+1]));
    }
    cout << ans << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <stack>
using namespace std;
const int maxn = 200007;
int n;
int a[maxn];

int main() {
    cin >> n;
    for (int i = 1; i <= 2*n; ++i) {
        cin >> a[i];
    }
    sort(a+1, a+2*n+1);
    long long ans = (a[2*n] - a[n+1]) * (a[n]-a[1]);
    for (int i = n+1; i < 2*n ; ++i) {
        ans = min(ans, (long long)(a[2*n]-a[1]) * (a[i]-a[i-n+1]));
    }
    cout << ans << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <stack>
using namespace std;
const int maxn = 1e5+5;
int n;
int a[maxn*2];
int minf(int i, int j) {
    return i<j?i:j;
}
int main() {
    cin >> n;
    for (int i = 1; i <= 2*n; ++i) {
        cin >> a[i];
    }
    sort(a+1, a+2*n+1);
    long long ans = (a[2*n] - a[n+1]) * (a[n]-a[1]);
    for (int i = n+1; i < 2*n ; ++i) {
        ans = minf(ans, (a[2*n]-a[1]) * (a[i]-a[i-n+1]));
    }
    cout << ans << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <stack>
using namespace std;
const int maxn = 1e5+5;
int n;
int a[maxn];
int minf(int i, int j) {
    return i<j?i:j;
}
int main() {
    cin >> n;
    for (int i = 1; i <= 2*n; ++i) {
        cin >> a[i];
    }
    sort(a, a+2*n);
    long long ans = (a[2*n] - a[n+1]) * (a[n]-a[1]);
    for (int i = n+1; i < 2*n ; ++i) {
        ans = minf(ans, (a[2*n]-a[1]) * (a[i]-a[i-n+1]));
    }
    cout << ans << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <stack>
using namespace std;
const int maxn = 200007;
int n;
int a[maxn];
int minf(int i, int j) {
    return i<j?i:j;
}
int main() {
    cin >> n;
    for (int i = 1; i <= 2*n; ++i) {
        cin >> a[i];
    }
    sort(a+1, a+2*n+1);
    long long ans = (a[2*n] - a[n+1]) * (a[n]-a[1]);
    for (int i = n+1; i < 2*n ; ++i) {
        ans = minf(ans, (a[2*n]-a[1]) * (a[i]-a[i-n+1]));
    }
    cout << ans << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <stack>
using namespace std;
const int maxn = 1e5+5;
int n;
int a[maxn];
int main() {
    cin >> n;
    for (int i = 0; i < 2*n; ++i) {
        cin >> a[i];
    }
    sort(a, a+2*n);
    cout << (a[2*n-1] - a[n]) * (a[n-1]-a[0]) << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <stack>
using namespace std;
const int maxn = 1e5+5;
int n;
int a[maxn];
int minf(int i, int j) {
    return i<j?i:j;
}
int main() {
    cin >> n;
    for (int i = 0; i < 2*n; ++i) {
        cin >> a[i];
    }
    sort(a, a+2*n);
    long long ans = (a[2*n-1] - a[n]) * (a[n-1]-a[0]);
    for (int i = n; i < 2*n ; ++i) {
        ans = minf(ans, (a[2*n-1]-a[0])* (a[i]-a[i-n+1]));
    }
    cout << ans << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <stack>
using namespace std;
const int maxn = 200007;
int n;
long long a[maxn];

int main() {
    cin >> n;
    for (int i = 1; i <= 2*n; ++i) {
        cin >> a[i];
    }
    sort(a+1, a+2*n+1);
    long long ans = (a[2*n] - a[n+1]) * (a[n]-a[1]);
    for (int i = n+1; i < 2*n ; ++i) {
        ans = min(ans, (a[2*n]-a[1]) * (a[i]-a[i-n+1]));
    }
    cout << ans << endl;
    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define FOR(i, a, b) for(int i = a; i < b; i++)
#define pb push_back
#define ios ios_base::sync_with_stdio(0); cin.tie(0);

typedef long long ll;
typedef pair<int, int> ii;

const int N = 1e5 + 5;
int n, a[N];
int main() {

    scanf("%d", &n);
    n = n + n;
    FOR(i,0,n)scanf("%d", a + i);

    sort(a,a+n);

     ll ans = (a[n-1] - a[n/2]) * 1ll * (a[n/2-1] - a[0]);

    FOR(i,0,n/2){
        ans = min(ans,(a[n-1]-a[i]) * 1ll * (a[n/2] - a[0]));
    }

    FOR(i,n/2,n){
        ans = min(ans, (a[n-1] - a[n/2-1]) * 1ll * (a[i] - a[0]));
    }

    cout << ans <<  endl;

    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define FOR(i, a, b) for(int i = a; i < b; i++)
#define pb push_back
#define ios ios_base::sync_with_stdio(0); cin.tie(0);

typedef long long ll;
typedef pair<int, int> ii;

const int N = 1e5 + 5;
int n, a[N+N];
int main() {

    scanf("%d", &n);
    n = n + n;
    FOR(i,0,n)scanf("%d", a + i);

    sort(a,a+n);

     ll ans = (a[n-1] - a[n/2]) * 1ll * (a[n/2-1] - a[0]);

    FOR(i,0,n/2){
        ans = min(ans,(a[n-1]-a[i]) * 1ll * (a[n/2] - a[0]));
    }

    FOR(i,n/2,n){
        ans = min(ans, (a[n-1] - a[n/2-1]) * 1ll * (a[i] - a[0]));
    }

    for(int i = 1; i + n/2 -1 < n-1; i++){
        ans = min(ans,(a[i+n/2-1]-a[i]) * 1ll * (a[n-1]-a[0]));
    }

    cout << ans <<  endl;

    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define FOR(i, a, b) for(int i = a; i < b; i++)
#define pb push_back
#define ios ios_base::sync_with_stdio(0); cin.tie(0);

typedef long long ll;
typedef pair<int, int> ii;

const int N = 1e5 + 5;
int n, a[N];
int main() {

    ll ans = LLONG_MAX;

    scanf("%d", &n);
    n = n + n;
    FOR(i,0,n)scanf("%d", a + i);

    sort(a,a+n);

    cout << (a[n-1] - a[n/2]) * 1ll * (a[n/2-1] - a[0]) << '\n';

    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define FOR(i, a, b) for(int i = a; i < b; i++)
#define pb push_back
#define ios ios_base::sync_with_stdio(0); cin.tie(0);

typedef long long ll;
typedef pair<int, int> ii;

const int N = 1e5 + 5;
int n, a[N];
int main() {

    scanf("%d", &n);
    n = n + n;
    FOR(i,0,n)scanf("%d", a + i);

    sort(a,a+n);

     ll ans = (a[n-1] - a[n/2]) * 1ll * (a[n/2-1] - a[0]);

    FOR(i,0,n/2){
        ans = min(ans,(a[n-1]-a[i]) * 1ll * (a[n/2] - a[0]));
    }

    FOR(i,n/2,n){
        ans = min(ans, (a[n-1] - a[n/2-1]) * 1ll * (a[i] - a[0]));
    }

    for(int i = 1; i + n/2 -1 < n-1; i++){
        ans = min(ans,(a[i+n/2-1]-a[i]) * 1ll * (a[n-1]-a[0]));
    }

    cout << ans <<  endl;

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

const int N = 200010;
int a[N];

int main()
{
	int n;
	ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 1; i <= 2 * n; i++)
		cin >> a[i];
	sort(a + 1, a + n * 2 + 1);
	long long ans = 1LL * (a[n] - a[1]) * (a[2 * n] - a[2 * n - 1]);
	cout << ans << endl;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

const int N = 200010;
int a[N];

int main()
{
	int n;
	ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 1; i <= 2 * n; i++)
		cin >> a[i];
	sort(a + 1, a + n * 2 + 1);
	long long ans = 1LL * (a[n] - a[1]) * (a[2 * n] - a[n + 1]);
	cout << ans << endl;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

const int N = 200010;
int a[N];

int main()
{
	int n;
	ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 1; i <= 2 * n; i++)
		cin >> a[i];
	sort(a + 1, a + n * 2 + 1);
	long long ans = 1LL * (a[n] - a[1]) * (a[2 * n] - a[n + 1]);
	for (int i = n + 1; i < 2 * n; i++) {
		ans = min(ans, 1LL * (a[2 * n] - a[1]) * (a[i] - a[i - n + 1]));
	}
	cout << ans << endl;
	return 0;
}


#include<bits/stdc++.h>
#define int long long
#define reg register
#define Open(s) freopen(s".in","r",stdin);freopen(s".out","w",stdout);
using namespace std;
inline int read(){
	int x=0,f=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f=ch=='-';
	for(;isdigit(ch);ch=getchar())x=(x<<3)+(x<<1)+(ch^48);return f?-x:x;
}
inline int Max(int a,int b){return a>b?a:b;}
inline int Min(int a,int b){return a>b?b:a;}
inline int Abs(int x){return x>0?x:-x;}
inline void put(int x){if(x>=10)put(x/10),putchar((x%10)^48);if(x>=0 && x<=9)putchar(x^48);}
inline void print(int x,char ch='\n'){put(x),putchar(ch);}
int n,ans;
int a[200010];
signed main(){
	n=read();
	for(reg int i=1;i<=(n<<1);i++){
		a[i]=read();
	}
	sort(a+1,a+(n<<1)+1);
	ans=(a[n]-a[1])*(a[n<<1]-a[n+1]);
	for(reg int i=1;i<=n;i++)
		ans=Min((a[n<<1]-a[1])*(a[i+n]*a[i+1]),ans);
	print(ans);
	return 0;
}


#include<bits/stdc++.h>
#define int long long
#define reg register
#define Open(s) freopen(s".in","r",stdin);freopen(s".out","w",stdout);
using namespace std;
inline int read(){
	int x=0,f=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f=ch=='-';
	for(;isdigit(ch);ch=getchar())x=(x<<3)+(x<<1)+(ch^48);return f?-x:x;
}
inline int Max(int a,int b){return a>b?a:b;}
inline int Min(int a,int b){return a>b?b:a;}
inline int Abs(int x){return x>0?x:-x;}
inline void put(int x){if(x>=10)put(x/10),putchar((x%10)^48);if(x>=0 && x<=9)putchar(x^48);}
inline void print(int x,char ch='\n'){put(x),putchar(ch);}
int n,ans;
int a[200010];
signed main(){
	n=read();
	for(reg int i=1;i<=(n<<1);i++){
		a[i]=read();
	}
	sort(a+1,a+(n<<1)+1);
	ans=(a[n]-a[1])*(a[n<<1]-a[n+1]);
	for(reg int i=1;i<=n;i++)
		ans=Min( (a[n<<1]-a[1]) * (a[i+n]+a[i+1]) ,ans);
	print(ans);
	return 0;
}


#include<bits/stdc++.h>
#define int long long
#define reg register
#define Open(s) freopen(s".in","r",stdin);freopen(s".out","w",stdout);
using namespace std;
inline int read(){
	int x=0,f=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f=ch=='-';
	for(;isdigit(ch);ch=getchar())x=(x<<3)+(x<<1)+(ch^48);return f?-x:x;
}
inline int Max(int a,int b){return a>b?a:b;}
inline int Min(int a,int b){return a>b?b:a;}
inline int Abs(int x){return x>0?x:-x;}
inline void put(int x){if(x>=10)put(x/10),putchar((x%10)^48);if(x>=0 && x<=9)putchar(x^48);}
inline void print(int x,char ch='\n'){put(x),putchar(ch);}
int n,ans;
int a[200010];
signed main(){
	n=read();
	for(reg int i=1;i<=(n<<1);i++){
		a[i]=read();
	}
	sort(a+1,a+(n<<1)+1);
	ans=(a[n]-a[1])*(a[n<<1]-a[n+1]);
	for(reg int i=1;i<n;i++)
		ans=Min(     (a[n<<1]-a[1]) * (a[i+n]-a[i+1]) ,ans);
	print(ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
     cin>>n;
        vector<long long> A;
         int x;
      for(int i = 0 ; i<n*2 ; i++)
      {
          scanf("%d",&x);
           A.push_back(x);
      }
       sort(A.begin(),A.end());
       long long mins = A[0];
       long long maxs = A[A.size()-1];
       int begins = 0;
       int lasts = A.size()-2;
        long long minn = 10000000000;
        for(int i = 1 ; i+n-1<2*n ; i++)
        {
             minn = min(minn,A[i+n-1]-A[i]);
        }
      long long sizw = (maxs-mins)*(minn);
       long long sizww = (A[n-1]-A[0])*(A[2*n-1]-A[n]);
          long long ans  = min(sizw,sizww);
          cout<<ans<<endl;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
     cin>>n;
        vector<long long> A;
         int x;
      for(int i = 0 ; i<n*2 ; i++)
      {
          scanf("%d",&x);
           A.push_back(x);
      }
       sort(A.begin(),A.end());
       long long mins = A[0];
       long long maxs = A[A.size()-1];
       int begins = 0;
       int lasts = A.size()-2;
        long long minn = 10000000000;
        for(int i = 1 ; i+n-1<n ; i++)
        {
             minn = min(minn,A[i+n-1]-A[i]);
        }
      long long sizw = (maxs-mins)*(minn);
       long long sizww = (A[n-1]-A[0])*(A[2*n-1]-A[n]);
         int ans  = min(sizw,sizww);
          cout<<ans<<endl;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
     cin>>n;
        vector<int> A;
         int x;
      for(int i = 0 ; i<n*2 ; i++)
      {
          scanf("%d",&x);
           A.push_back(x);
      }
       sort(A.begin(),A.end());
       int mins = A[0];
       int maxs = A[A.size()-1];
       int begins = 0;
       int lasts = A.size()-2;
       for(int i = 0 ; i<n; i+=2)
       {
           begins++;
           lasts--;
       }
        int sizw = (maxs-mins)*(A[lasts]-A[begins]);
        int sizww = (A[n-1]-A[0])*(A[2*n-1]-A[n]);
         int ans  = min(sizw,sizww);
          cout<<ans<<endl;
}


#include<bits/stdc++.h>
#define mod 998244353
using namespace std;
inline long long read(){
	long long x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
long long a[200100];
int main(){
	int n=read();
	for(int i=1;i<=2*n;++i)a[i]=read();
	sort(a+1,a+1+n*2);
	long long ans=(a[n]-a[1])*(a[2*n]-a[n+1]);
	for(int i=2;i<n;++i){
		ans=min((a[n]-a[1])*(a[i+n]-a[i]),ans);
	}
	cout<<ans<<endl;
}


#include<bits/stdc++.h>
#define mod 998244353
using namespace std;
inline long long read(){
	long long x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
long long a[200100];
int main(){
	int n=read();
	for(int i=1;i<=2*n;++i)a[i]=read();
	sort(a+1,a+1+n*2);
	long long ans=(a[n]-a[1])*(a[2*n]-a[n+1]);
	for(int i=2;i<=n;++i){
		ans=min((a[n*2]-a[1])*(a[i+n-1]-a[i]),ans);
	}
	cout<<ans<<endl;
}


#include<bits/stdc++.h>
#define mod 998244353
using namespace std;
inline long long read(){
	long long x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
long long a[200100];
int main(){
	int n=read();
	for(int i=1;i<=2*n;++i)a[i]=read();
	sort(a+1,a+1+n*2);
	long long ans=(a[n]-a[1])*(a[2*n]-a[n+1]);
	for(int i=2;i<=n;++i){
		ans=min((a[n]-a[1])*(a[i+n-1]-a[i]),ans);
	}
	cout<<ans<<endl;
}


#include <iostream>
#include <algorithm>
#include <utility>
#include <map>
#define ll long long
using namespace std;
int main() {
	int n;
	cin >> n;
	pair<ll, ll> a[n];
	map<int, int> mp;
	ll b[n<<1];
	for (int i = 0;i < n * 2;i++) {
		cin>> b[i];
		if (!mp[b[i]]) mp[b[i]] = 1;
		else {
			mp[b[i]]++;
		}
		if (mp[b[i]] == n) {
			cout << 0 << endl;
			return 0;
		}
	}
	sort(b, b + 2 * n);
	ll ans = (b[n - 1] - b[0]) * (b[2 * n - 1] - b[n]);
	cout << ans << endl;
	/*
	ll minx = 1LL<<60, miny = 1LL<<60, maxx = 0, maxy = 0;
	for (int i= 0;i < n;i++) {
		minx = min(minx, a[i].first);
		maxx = max(maxx, a[i].first);
		miny = min(miny, a[i].second);
		maxy = max(maxy, a[i].second);
	}
	cout << (maxx - minx) * (maxy - miny) << endl;
	*/
}


#include <iostream>
#include <algorithm>
#include <utility>
#define ll long long
using namespace std;
int main() {
	int n;
	cin >> n;
	pair<ll, ll> a[n];
	ll b[n<<1];
	for (int i = 0;i < n * 2;i++) cin>> b[i];
	sort(b, b + 2 * n);
	ll ans = (b[n - 1] - b[0]) * (b[2 * n - 1] - b[n]);
	cout << ans << endl;
	/*
	ll minx = 1LL<<60, miny = 1LL<<60, maxx = 0, maxy = 0;
	for (int i= 0;i < n;i++) {
		minx = min(minx, a[i].first);
		maxx = max(maxx, a[i].first);
		miny = min(miny, a[i].second);
		maxy = max(maxy, a[i].second);
	}
	cout << (maxx - minx) * (maxy - miny) << endl;
	*/
}


#include <iostream>
#include <algorithm>
#include <utility>
#include <map>
#define ll long long
using namespace std;
int main() {
	int n;
	cin >> n;
	pair<ll, ll> a[n];
	map<int, int> mp;
	ll b[n<<1];
	for (int i = 0;i < n * 2;i++) {
		cin>> b[i];
		if (!mp[b[i]]) mp[b[i]] = 1;
		else {
			mp[b[i]]++;
		}
		if (mp[b[i]] == n) {
			cout << 0 << endl;
			return 0;
		}
	}
	sort(b, b + 2 * n);
	ll ans = (b[n - 1] - b[0]) * (b[2 * n - 1] - b[n]);
	for (int i = 1;i < n;i++) {
		ans = min(ans, (b[i + n - 1] - b[i]) * (b[2 * n - 1] - b[0]));
	}
	cout << ans << endl;
	/*
	ll minx = 1LL<<60, miny = 1LL<<60, maxx = 0, maxy = 0;
	for (int i= 0;i < n;i++) {
		minx = min(minx, a[i].first);
		maxx = max(maxx, a[i].first);
		miny = min(miny, a[i].second);
		maxy = max(maxy, a[i].second);
	}
	cout << (maxx - minx) * (maxy - miny) << endl;
	*/
}


#include<bits/stdc++.h>
#define rgt register
#define rint rgt int
#define LL long long
#define rll rgt LL
#define inf 0x7f7f7f7f
#define N 100007
using namespace std;
template<class K>inline bool cmax(K&a,const K&b){return(a<b)?a=b,1:0;}
template<class K>inline bool cmin(K&a,const K&b){return(a>b)?a=b,1:0;}
inline int read() {
	rgt int s=0;
	rgt char c=getchar();
	while(!isdigit(c)) c=getchar();
	while(isdigit(c)) s=(s<<1)+(s<<3)+c-'0',c=getchar();
	return s;
}
int n,a[N<<1],m,res;
LL ans;
int main() {
	rint i,j;n=read(),m=n<<1;
	for(i=1;i<=m;i++) a[i]=read();
	sort(a+1,a+m+1),res=inf;
	ans=(LL)(a[n]-a[1])*(a[m]-a[n+1]);
	for(i=2;i<n;i++) cmin(res,a[i+n-1]-a[i]);
	printf("%lld",min(ans,(LL)res*(a[m]-a[1])));
	return 0;
}


#include<bits/stdc++.h>
#define rgt register
#define rint rgt int
#define LL long long
#define rll rgt LL
#define inf 0x7f7f7f7f
#define N 100007
using namespace std;
template<class K>inline bool cmax(K&a,const K&b){return(a<b)?a=b,1:0;}
template<class K>inline bool cmin(K&a,const K&b){return(a>b)?a=b,1:0;}
inline int read() {
	rgt int s=0;
	rgt char c=getchar();
	while(!isdigit(c)) c=getchar();
	while(isdigit(c)) s=(s<<1)+(s<<3)+c-'0',c=getchar();
	return s;
}
int n,a[N<<1],m;
LL ans;
int main() {
	rint i,j;n=read(),m=n<<1;
	for(i=1;i<=m;i++) a[i]=read();
	sort(a+1,a+m+1);
	ans=(LL)(a[n]-a[1])*(a[m]-a[n+1]);
	for(i=2;i<n;i++) {
		cmin(ans,(LL)(a[i+n-1]-a[i])*(a[m]-a[1]));
	}printf("%lld",ans);
	return 0;
}


#include<bits/stdc++.h>
#define rgt register
#define rint rgt int
#define LL long long
#define rll rgt LL
#define inf 0x7f7f7f7f
#define N 100007
using namespace std;
template<class K>inline bool cmax(K&a,const K&b){return(a<b)?a=b,1:0;}
template<class K>inline bool cmin(K&a,const K&b){return(a>b)?a=b,1:0;}
inline int read() {
	rgt int s=0;
	rgt char c=getchar();
	while(!isdigit(c)) c=getchar();
	while(isdigit(c)) s=(s<<1)+(s<<3)+c-'0',c=getchar();
	return s;
}
int n,a[N<<1];
int main() {
	rint i,j;n=read()<<1;
	for(i=1;i<=n;i++) a[i]=read();
	sort(a+1,a+n+1);
	if(n==2) printf("0");
	else printf("%lld",(LL)(a[n/2]-a[1])*(a[n]-a[n/2+1]));
	return 0;
}


#include<bits/stdc++.h>
#define rgt register
#define rint rgt int
#define LL long long
#define rll rgt LL
#define inf 0x7f7f7f7f
#define N 100007
using namespace std;
template<class K>inline bool cmax(K&a,const K&b){return(a<b)?a=b,1:0;}
template<class K>inline bool cmin(K&a,const K&b){return(a>b)?a=b,1:0;}
inline int read() {
	rgt int s=0;
	rgt char c=getchar();
	while(!isdigit(c)) c=getchar();
	while(isdigit(c)) s=(s<<1)+(s<<3)+c-'0',c=getchar();
	return s;
}
int n,a[N<<1],m,res;
LL ans;
int main() {
	rint i,j;n=read(),m=n<<1;
	for(i=1;i<=m;i++) a[i]=read();
	sort(a+1,a+m+1),res=inf;
	ans=(LL)(a[n]-a[1])*(a[m]-a[n+1]);
	for(i=2;i<=n;i++) cmin(res,a[i+n-1]-a[i]);
	printf("%lld",min(ans,(LL)res*(a[m]-a[1])));
	return 0;
}


#include <cmath>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int main()
{
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	vector<ll> a(n);
	for(int i=0; i<2*n; ++i)
		cin >> a[i];
	sort(a.begin(), a.end());
	ll ans = (a[n/2-1] - a[0]) * (a[n-1] - a[n/2]);
	for(int i=0; i+n/2-1<n; ++i)
	{
		ans = min(ans, (a[n-1] - a[0]) * (a[i+n/2-1] - a[i]));
	}

	cout << ans << "\n";

	return 0;
}


#include <cmath>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int main()
{
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	vector<ll> a(n);
	for(int i=0; i<n; ++i)
		cin >> a[i];
	sort(a.begin(), a.end());
	ll ans = (a[n/2-1] - a[0]) * (a[n-1] - a[n/2]);
	for(int i=0; i+n/2-1<n; ++i)
	{
		ans = min(ans, (a[n-1] - a[0]) * (a[i+n/2-1] - a[i]));
	}

	cout << ans << "\n";

	return 0;
}


#include <cmath>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int main()
{
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	n *= 2;
	vector<ll> a(n);
	for(int i=0; i<n; ++i)
		cin >> a[i];
	sort(a.begin(), a.end());
	ll ans = (a[n/2-1] - a[0]) * (a[n-1] - a[n/2]);
	for(int i=0; i+n/2-1<n; ++i)
	{
		ans = min(ans, (a[n-1] - a[0]) * (a[i+n/2-1] - a[i]));
	}

	cout << ans << "\n";

	return 0;
}


#include <cmath>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int main()
{
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	vector<ll> a(n);
	for(int i=0; i<n; ++i)
		cin >> a[i];
	sort(a.begin(), a.end());
	ll ans = (a[n/2-1] - a[0]) * (a[n-1] - a[n/2]);
	for(int i=0; i+n/2<n; ++i)
	{
		ans = min(ans, (a[n-1] - a[0]) * (a[i+n/2] - a[i]));
	}

	cout << ans << "\n";

	return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
long long v[200005],minim;
int main()
{
    long long n;
    cin>>n;
    for(long long i=1;i<=2*n;i++){
        cin>>v[i];
    }
    sort(v+1,v+2*n+1);
    minim=(v[n]-v[1])*(v[2*n]-v[n+1]);
    for(long long i=2;i<=n;i++){
        minim=min(minim,(v[2*n]-v[1])*(v[i+n-1]-v[i]));
    }
    cout<<minim;
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
int v[200005];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=2*n;i++){
        cin>>v[i];
    }
    sort(v+1,v+2*n+1);
    cout<<(v[n]-v[1])*(v[2*n]-v[n+1]);
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
int v[200005],minim;
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=2*n;i++){
        cin>>v[i];
    }
    sort(v+1,v+2*n+1);
    minim=(v[n]-v[1])*(v[2*n]-v[n+1]);
    for(int i=2;i<=n;i++){
        minim=min(minim,(v[2*n]-v[1])*(v[i+n-1]-v[i]));
    }
    cout<<minim;
    return 0;
}


#include <bits/stdc++.h>
#define author_by_CutieRabbit cin.tie(0); ios::sync_with_stdio(false);
#define int long long
using namespace std;

int32_t main() {
    author_by_CutieRabbit
    int T;
    cin >> T;
    while(T--){
        int n, k;
        cin >> n >> k;
        vector<int> vec(n);
        for(int i = 0; i < n; i++){
            cin >> vec[i];
        }
        int dist = *max_element(vec.begin(), vec.end());
        if(dist > k){
            cout << 2 << endl;
        }else{
            cout << (k%dist==0?k/dist:k/dist+1) << endl;
        }
    }
}


#include <bits/stdc++.h>
#define author_by_CutieRabbit cin.tie(0); ios::sync_with_stdio(false);
#define int long long
using namespace std;

int32_t main() {
    author_by_CutieRabbit
    int T;
    cin >> T;
    while(T--){
        int n, k;
        cin >> n >> k;
        vector<int> vec(n);
        int s = 1e18;
        for(int i = 0; i < n; i++){
            cin >> vec[i];
            if(k%vec[i]==0) s = k/vec[i];
        }
        int mx = *max_element(vec.begin(), vec.end());
        cout << min(s, max((int)ceil((double)k/mx),2LL)) << endl;
    }
}


#include <bits/stdc++.h>
#define author_by_CutieRabbit cin.tie(0); ios::sync_with_stdio(false);
#define int long long
using namespace std;

int32_t main() {
    author_by_CutieRabbit
    int T;
    cin >> T;
    while(T--){
        int n, k;
        cin >> n >> k;
        vector<int> vec(n);
        int s = 1e9;
        for(int i = 0; i < n; i++){
            cin >> vec[i];
            if(k % vec[i] == 0) s = min(s, k / vec[i]);
        }
        int mx = *max_element(vec.begin(), vec.end());
        double c = (double)k/2;
        cout << min(s, (int)ceil(c/mx)*2) << endl;
    }
}


#include <bits/stdc++.h>
#define author_by_CutieRabbit cin.tie(0); ios::sync_with_stdio(false);
#define int long long
using namespace std;

int32_t main() {
    author_by_CutieRabbit
    int T;
    cin >> T;
    while(T--){
        int n, k;
        cin >> n >> k;
        vector<int> vec(n);
        int s = 1e9;
        for(int i = 0; i < n; i++){
            cin >> vec[i];
            if(k%vec[i]==0) s = k/vec[i];
        }
        int mx = *max_element(vec.begin(), vec.end());
        int a = mx*2 > k ? 2 : 1e9;
        cout << min({s, a, k/mx+2}) << endl;
    }
}


#include <bits/stdc++.h>
#define author_by_CutieRabbit cin.tie(0); ios::sync_with_stdio(false);
#define int long long
using namespace std;

int32_t main() {
    author_by_CutieRabbit
    int T;
    cin >> T;
    while(T--){
        int n, k;
        cin >> n >> k;
        vector<int> vec(n);
        int s = 1e9;
        for(int i = 0; i < n; i++){
            cin >> vec[i];
            if(k % vec[i] == 0) s = k / vec[i];
        }
        int dist = *max_element(vec.begin(), vec.end());
        if(dist > k){
            cout << 2 << endl;
        }else{
            cout << min(s, 2*(k/dist)) << endl;
        }
    }
}