//给你一个长度为2n 的数组，将这个数组分为两个可重集，每个集合有n 个元素，使得这两个集合的极差之积最小，输出这个最小值
//https://www.luogu.org/problemnew/solution/CF1012A
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define maxn 100005
using namespace std;
long long a[maxn*2];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<2*n;i++)
        scanf("%lld",&a[i]);
    sort(a,a+2*n);
    long long ans = (a[n-1]-a[0])*(a[2*n-1]-a[n]);

    long long xx=a[2*n-1]-a[0];
    long long minx = ans;
    for(int i=1;i<n;i++)
    {
        //printf("%d %d\n",i,i+n-1);
        minx=min(minx,1ll*(a[i+n-1]-a[i])*xx);
    }
    printf("%lld\n",minx);
    return 0;
}


//给你一个长度为2n 的数组，将这个数组分为两个可重集，每个集合有n 个元素，使得这两个集合的极差之积最小，输出这个最小值
//https://www.luogu.org/problemnew/solution/CF1012A
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define maxn 100005
using namespace std;
int a[maxn*2];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<2*n;i++)
        scanf("%d",&a[i]);
    sort(a,a+2*n);
    long long ans = (a[n-1]-a[0])*(a[2*n-1]-a[n]);

    long long xx=a[2*n-1]*a[0];
    long long minx=1000000006;
    for(int i=1;i<n;i++)
    {
        //printf("%d %d\n",i,i+n-1);
        minx=min(minx,1ll*a[i+n-1]-a[i]);
    }
    ans = min(ans,xx*minx);
    printf("%lld\n",ans);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <map>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

using namespace std;

const int N=200005;
const long long INFll=0x3f3f3f3f3f3f3f3fll;

int n;
int a[N];
long long ans=INFll;

map<int,int> M1,M2;
map<int,int>::iterator it;

inline void add(map<int,int>& M,int val){
	M[val]++;
}

inline void del(map<int,int>& M,int val){
	M[val]--;
	if(M[val]==0) M.erase(val);
}

inline long long calc(){
	long long res=1;
	res*=(--M1.end())->first-M1.begin()->first;
	res*=(--M2.end())->first-M2.begin()->first;
	return res;
}

void init(){
	scanf("%d",&n);
	for(int i=1;i<=2*n;i++){
		scanf("%d",&a[i]);
	}
	sort(a+1,a+2*n+1);
	for(int i=1;i<=n;i++){
		add(M1,a[i]);
	}
	for(int i=n+1;i<=2*n;i++){
		add(M2,a[i]);
	}
	ans=min(ans,calc());
	for(int i=n+1;i<=2*n;i++){
		del(M1,a[i-n]);
		add(M2,a[i-n]);
		del(M2,a[i]);
		add(M1,a[i]);
		ans=min(ans,calc());
	}
	printf("%lld\n",ans);
}

int main(int argc, char** argv) {
	init();
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <map>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

using namespace std;

const int N=200005;
const long long INFll=0x3f3f3f3f3f3f3f3fll;

int n;
int a[N];
long long ans=INFll;

map<int,int> M1,M2;
map<int,int>::iterator it;

inline void add(map<int,int>& M,int val){
	M[val]++;
}

inline void del(map<int,int>& M,int val){
	M[val]--;
	if(M[val]==0) M.erase(val);
}

inline long long calc(){
	long long res=1;
	res*=(--M1.end())->first-M1.begin()->first;
	res*=(--M2.end())->first-M2.begin()->first;
}

void init(){
	scanf("%d",&n);
	for(int i=1;i<=2*n;i++){
		scanf("%d",&a[i]);
	}
	sort(a+1,a+2*n+1);
	for(int i=1;i<=n;i++){
		add(M1,a[i]);
	}
	for(int i=n+1;i<=2*n;i++){
		add(M2,a[i]);
	}
	ans=min(ans,calc());
	for(int i=n+1;i<=2*n;i++){
		del(M1,a[i-n]);
		add(M2,a[i-n]);
		del(M2,a[i]);
		add(M1,a[i]);
		ans=min(ans,calc());
	}
	printf("%lld\n",ans);
}

int main(int argc, char** argv) {
	init();
	return 0;
}


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

#define MN 200005
int n,m;
int a[MN],b[MN];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n*2;++i)scanf("%d",a+i);
	sort(a+1,a+n*2+1);long long res=1ll*(a[n]-a[1])*(a[n*2]-a[n+1]);
	for(int i=1;i<=n;++i){
		res=min(res,1ll*(a[n*2]-a[1])*(a[n+i-1]-a[i]));
	}
	printf("%lld",res);
	return 0;
}


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

#define MN 200005
int n,m;
int a[MN];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n*2;++i)scanf("%d",a+i);
	sort(a+1,a+n*2+1);
	printf("%lld",1ll*(a[n]-a[1])*(a[n*2]-a[n+1]));
	return 0;
}


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cctype>
#include<iostream>
#include<string>
#include<sstream>
#include<set>
#include<map>
#include<vector>
#include<algorithm>
#include<queue>
#include<utility>
using namespace std;

#define i64 long long int

#define ran 101101

int n;
int a[ran*2];

int main() {
	scanf("%d", &n);
	for(int i=0;i<n*2;i++) scanf("%d", &a[i]);
	sort(a, a+n*2);

	long long ans = 1LL*(a[n-1]-a[0])*(a[n*2-1]-a[n]);
	for(int i=0;i<n;i++)
		ans = min(ans, 1LL*(a[n*2-1]-a[0])*(a[i+n-1]-a[i]));
	cout<<ans<<endl;

	return 0;
}


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cctype>
#include<iostream>
#include<string>
#include<sstream>
#include<set>
#include<map>
#include<vector>
#include<algorithm>
#include<queue>
#include<utility>
using namespace std;

#define i64 long long int

#define ran 101101

int n;
int a[ran*2];

int main() {
	scanf("%d", &n);
	for(int i=0;i<n*2;i++) scanf("%d", &a[i]);
	sort(a, a+n*2);

	long long ans = 1LL*(a[n-1]-a[0])*(a[n*2-1]-a[n]);
	for(int i=1;i<n-1;i++)
		ans = min(ans, 1LL*(a[n*2-1]-a[0])*(a[i+n-1]-a[i]));
	cout<<ans<<endl;

	return 0;
}


#include <bits/stdc++.h>

#define int long long

const int MaxN = 100000 + 5;

int N;
int A[MaxN << 1];
int Ans;

inline int read()
{
    register int x = 0, v = 1;
    register char ch = getchar();
    while(!isdigit(ch))
    {
        if(ch == '-') v = -1;
        ch = getchar();
    }
    while(isdigit(ch))
    {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    return x * v;
}

signed main()
{
	N = read();
	for(int i = 1; i <= N << 1; ++i) A[i] = read();
	std::sort(A + 1, A + (N * 2 + 1));
	Ans = (A[N] - A[1]) * (A[N << 1] - A[N + 1]);
	for(int i = 2; i <= N; ++i)
	{
		int j = i + N - 1;
		Ans = std::min(Ans, (A[j] - A[i]) * (A[N << 1] - A[1]));
	}
	printf("%lld\n", Ans);
	return 0;
}


#include<bits/stdc++.h>
#define N 200005
#define int long long
using namespace std;

int n,a[N],ans;

signed main()
{
	scanf("%I64d",&n);n<<=1;
	for(int i=1;i<=n;i++)
		scanf("%I64d",&a[i]);
	sort(a+1,a+1+n);
	ans=(a[n>>1]-a[1])*(a[n]-a[(n>>1)+1]);
	for(int i=2;i<=(n>>1)+1;i++)
		ans=min(ans,(a[n]-a[1])*(a[i+(n>>1)-1]-a[i]));
	cout<<ans;

	return 0;
}


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

int a[200001];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=2*n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+2*n+1);
	printf("%I64d\n",1ll*(a[n]-a[1])*(a[2*n]-a[n+1]));
}


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

int a[200001];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=2*n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+2*n+1);
	long long ans=1ll*(a[n]-a[1])*(a[2*n]-a[n+1]);
	for(int i=2;i<n;i++)
		ans=min(ans,1ll*(a[i+n-1]-a[i])*(a[2*n]-a[1]));
	printf("%I64d\n",ans);
}


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

int a[200001];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=2*n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+2*n+1);
	long long ans=1ll*(a[n]-a[1])*(a[2*n]-a[n+1]);
	for(int i=2;i<n;i++)
		ans=min(ans,1ll*(a[i+n]-a[i])*(a[2*n]-a[1]));
	printf("%I64d\n",ans);
}


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

int a[200001];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=2*n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+2*n+1);
	long long ans=1ll*(a[n]-a[1])*(a[2*n]-a[n+1]);
	for(int i=2;i<=n;i++)
		ans=min(ans,1ll*(a[i+n-1]-a[i])*(a[2*n]-a[1]));
	printf("%I64d\n",ans);
}


#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <iomanip>

using namespace std;

int n;
int a[200005];

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


#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <iomanip>

using namespace std;

int n;
int a[200005];

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


#if 1
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<LD, LD> pdd;

#define X first
#define Y second
#define mp make_pair
#define pb push_back

int main(int argc, char** argv) {

    //    freopen("a.in", "r", stdin);
    //    freopen("a.out", "w", stdout);
    int n;
    cin >> n;
    vector<LL> as(n * 2);
    for (int i = 0; i < 2 * n; ++ i) {
        cin >> as[i];
    }
    sort(as.begin(), as.end());
    LL res = (as[n - 1] - as[0]) * (as[2 * n - 1] - as[n]);
    LL dy = as[2 * n - 1] - as[0];
    for (int i = 1; i + n < n * 2; ++ i) {
        if ((as[i + n - 1] - as[i]) * dy < res ) {
            res = (as[i + n - 1] - as[i]) * dy;
        }
    }
    cout << res << endl;
    return 0;
}

#endif


#if 1
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<LD, LD> pdd;

#define X first
#define Y second
#define mp make_pair
#define pb push_back

int main(int argc, char** argv) {

    //    freopen("a.in", "r", stdin);
    //    freopen("a.out", "w", stdout);
    int n;
    cin >> n;
    vector<LL> as(n * 2);
    for (int i = 0; i < 2 * n; ++ i) {
        cin >> as[i];
    }
    sort(as.begin(), as.end());
    LL res = (as[n - 1] - as[0]) * (as[2 * n - 1] - as[n]);
    cout << res << endl;
    return 0;
}

#endif


#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>

#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
int n;
cin>>n;
vll v;
rep(i,0,2*n-1)
{
	ll x;
	cin>>x;
	v.pb(x);
}
sort(all(v));
ll ans=(v[n-1]-v[0])*(v[2*n-1]-v[n]);
rep(i,1,n-1)
{
	ans=min(ans,(v[2*n-1]-v[0])*(v[i+n-1]-v[i]));
}
ol((ans));
return 0;
}


#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>

#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
int n;
cin>>n;
vll v;
rep(i,0,2*n-1)
{
	ll x;
	cin>>x;
	v.pb(x);
}
sort(all(v));

ol((v[n-1]-v[0])*(v[2*n-1]-v[n]));
return 0;
}


#include <cstdio>
#include <algorithm>

typedef long long ll;
#define maxn 200010
int a[maxn];
int main()
{
	int n; scanf("%d", &n);
	if (n == 1) {printf("0"); return 0;}
	for (int i = 1; i <= 2 * n; ++i) scanf("%d", a + i);

	std::sort(a + 1, a + 2 * n + 1);
	ll ans = 1ll * (a[n] - a[1]) * (a[2 * n] - a[n + 1]);

	for (int i = n + 1, j = 2; i < 2 * n; ++i, ++j)
	{
		ll tmp = 1ll * (a[2 * n] - a[1]) * (a[i] - a[j]);
		ans > tmp ? ans = tmp : 0;
	}
	printf("%lld\n", ans);
	return 0;
}


#include <cstdio>
#include <algorithm>

typedef long long ll;
#define maxn 200010
int a[maxn];
int main()
{
	int n; scanf("%d", &n);
	n <<= 1;
	for (int i = 1; i <= n; ++i) scanf("%d", a + i);
	std::sort(a + 1, a + n + 1);
	int mid = n >> 1;
	ll ans = 1ll * (a[mid] - a[1]) * (a[n] - a[mid + 1]);
	printf("%lld\n", ans);
	return 0;
}


#include <cstdio>
#include <algorithm>

typedef long long ll;
#define maxn 200010
int a[maxn];
int main()
{
	int n; scanf("%d", &n);
	if (n == 1) {printf("0"); return 0;}
	for (int i = 1; i <= 2 * n; ++i) scanf("%d", a + i);

	std::sort(a + 1, a + 2 * n + 1);
	ll ans = 1ll * (a[n] - a[1]) * (a[2 * n] - a[n + 1]);

	for (int i = n + 1, j = n; i < 2 * n; ++i, --j)
	{
		ll tmp = 1ll * (a[i] - a[1]) * (a[2 * n] - a[j]);
		ans > tmp ? ans = tmp : 0;
	}
	printf("%lld\n", ans);
	return 0;
}


#include <cstdio>
#include <algorithm>

typedef long long ll;
#define maxn 200010
int a[maxn];
int main()
{
	int n; scanf("%d", &n);
	if (n == 1) {printf("0"); return 0;}
	n <<= 1;
	for (int i = 1; i <= n; ++i) scanf("%d", a + i);
	std::sort(a + 1, a + n + 1);
	int mid = n >> 1;
	ll ans1 = 1ll * (a[mid] - a[1]) * (a[n] - a[mid + 1]);
	ll ans2 = 1ll * (a[n] - a[1]) * (a[mid + 1] - a[mid]);
	printf("%lld\n", std::min(ans1, ans2));
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define SF scanf
#define PF printf
#define MAXN 100010
using namespace std;
typedef long long ll;
int n;
int a[MAXN*2];
ll ans;
int main(){
	SF("%d",&n);
	for(int i=1;i<=2*n;i++)
		SF("%d",&a[i]);
	sort(a+1,a+1+2*n);
	ll x=a[n]-a[1];
	ll y=a[2*n]-a[n+1];
	ans=x*y;
	for(int i=n+1;i<=2*n-1;i++){
		x=a[i]-a[i-n+1];
		y=a[2*n]-a[1];
		ans=min(ans,x*y);
	}
	PF("%I64d\n",ans);
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define SF scanf
#define PF printf
#define MAXN 100010
using namespace std;
typedef long long ll;
int n;
int a[MAXN*2];
int main(){
	SF("%d",&n);
	for(int i=1;i<=2*n;i++)
		SF("%d",&a[i]);
	sort(a+1,a+1+2*n);
	ll x=a[n]-a[1];
	ll y=a[2*n]-a[n+1];
	PF("%I64d\n",x*y);
}


#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<cmath>
#include<ctime>
#include<queue>
#include<map>
#define LL long long
#define il inline
#define re register

using namespace std;
il LL rd()
{
    re LL x=0,w=1;re char ch=0;
    while(ch<'0'||ch>'9') {if(ch=='-') w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') {x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
    return x*w;
}
LL n,a[200010],ans,aa;

int main()
{
  n=rd();
  ans=aa=1ll<<60;
  for(int i=1;i<=n*2;i++) a[i]=rd();
  sort(a+1,a+n+n+1);
  for(int i=n;i<=n*2;i++) ans=min(ans,(a[i]-a[1])*(a[(i==n*2)?(n*2-1):(n*2)]-a[(i==n)?n+1:n]));
  for(int i=n+1;i<=2*n-1;i++) aa=min(aa,a[i]-a[i-n+1]);
  ans=min(ans,aa*(a[2*n]-a[1]));
  cout<<ans;
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define N 200010
#define ll long long
int n,a[N];ll ans=1e18;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=2*n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+2*n+1);
	for(int i=1;i<=n;i++){
		ll xmin=a[i],xmax=a[i+n-1];
		ll ymin=(i==1)?a[n+1]:a[1],ymax=a[2*n];
		ans=min(ans,(xmax-xmin)*(ymax-ymin));
	}
	cout<<ans<<endl;
	return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
int n,i;
long long v[200005],ans;
int main()
{
	scanf("%d",&n);
	for (i=1;i<=2*n;i++)
		scanf("%I64d",&v[i]);
	sort(v+1,v+2*n+1);
	ans=(v[2*n]-v[n+1])*(v[n]-v[1]);
	for (i=2;i<=n;i++)
		if ((v[i+n-1]-v[i])*(v[2*n]-v[1])<ans)
			ans=(v[i+n-1]-v[i])*(v[2*n]-v[1]);
	printf("%I64d\n",ans);
	return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
int n,i;
long long v[200005];
int main()
{
	scanf("%d",&n);
	for (i=1;i<=2*n;i++)
		scanf("%I64d",&v[i]);
	sort(v+1,v+2*n+1);
	printf("%I64d\n",(v[2*n]-v[n+1])*(v[n]-v[1]));
	return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
int n,i;
long long v[200005],ans;
int main()
{
	scanf("%d",&n);
	for (i=1;i<=2*n;i++)
		scanf("%I64d",&v[i]);
	sort(v+1,v+2*n+1);
	ans=0x7fffffffffffffff;
	for (i=0;i<=n-1;i++)
		if ((v[2*n]-v[n+1-i])*(v[n+i]-v[1])<ans)
			ans=(v[2*n]-v[n+1-i])*(v[n+i]-v[1]);
	printf("%I64d\n",ans);
	return 0;
}


#include <iostream>
#include <cstring>
#include <stdio.h>
#include <algorithm>
#include <stack>
#include <cmath>
using namespace std;
typedef long long ll;
const int N = 1e5 + 50;
int T, n, m, L, R;
int a[2*N];

int main( ){
    cin>>n;
    for (int i = 0; i < n*2; i++) {
        cin>>a[i];
    }
    if (n <= 1) {
        cout<<"0"<<endl;
        return 0;
    }
    sort(a, a+2*n);
    //1
    ll ans = (a[n-1] - a[0]) * (a[2*n-1] - a[n]);
    //2
    int C = a[2*n-1] - a[0];
    for (int i = 1; i <= n; i++) {
        ll temp = C * (a[i+n-1] - a[i]);
        if (temp < ans)
            ans = temp;
    }
    cout<<ans<<endl;
    return 0;
}


#include <iostream>
#include <cstring>
#include <stdio.h>
#include <algorithm>
#include <stack>
#include <cmath>
using namespace std;
typedef long long ll;
const int N = 1e5 + 50;
int T, n, m, L, R;
ll a[2*N];

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


#include <iostream>
#include <cstring>
#include <stdio.h>
#include <algorithm>
#include <stack>
#include <cmath>
using namespace std;
typedef long long ll;
const int N = 1e5 + 50;
int T, n, m, L, R;
int a[N];
char s[505];

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


#include <iostream>
#include <cstring>
#include <stdio.h>
#include <algorithm>
#include <stack>
#include <cmath>
using namespace std;
typedef long long ll;
const int N = 1e5 + 50;
int T, n, m, L, R;
int a[2*N];
char s[505];

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


#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

const int MAXN = 1e5 + 5;
int n;
ll record[2 * MAXN];
ll dist[2 * MAXN];
ll len1, len2, mins;

int main() {
	cin >> n;
	for (int i = 0; i < 2 * n; i++) {
		cin >> record[i];
	}
	sort(record, record + 2 * n);
	for (int i = 0; i < 2 * n - 1; i++) {
		dist[i] = record[i + 1] - record[i];
	}
	mins = (record[n - 1] - record[0]) * (record[2 * n - 1] - record[n]);
	len2 = record[2 * n - 1] - record[0];
	len1 = 0;
	for (int i = 1; i < n; i++) {
		len1 += dist[i];
	}
	mins = min(mins, len1 * len2);
	for (int i = 1; i < n - 1; i++) {
		len1 -= dist[i];
		len1 += dist[i + n];
		mins = min(mins, len1 * len2);
	}
	cout << mins << '\n';
	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

const int MAXN = 1e5 + 5;
int n;
ll record[2 * MAXN];
ll dist[2 * MAXN];
ll len1, len2, mins;

void dsp() {
	for (int i = 0; i < n; i++) {
		cout << record[i] << '\t';
	}
	cout << '\n';
	for (int i = 0; i < n; i++) {
		cout << record[i + n] << '\t';
	}
	cout << '\n';
	for (int i = 0; i < n; i++) {
		cout << dist[i] << '\t';
	}
	cout << '\n';
	for (int i = 0; i < n; i++) {
		cout << dist[i + n] << '\t';
	}
	cout << '\n';
}

int main() {
	cin >> n;
	for (int i = 0; i < 2 * n; i++) {
		cin >> record[i];
	}
	sort(record, record + 2 * n);
	for (int i = 0; i < 2 * n - 1; i++) {
		dist[i] = record[i + 1] - record[i];
	}
	mins = (record[n - 1] - record[0]) * (record[2 * n - 1] - record[n]);
	len2 = record[2 * n - 1] - record[0];
//	cout << len1 << '\t' << len2 << '\t' << mins << '\n';
//	dsp();
	for (int i = 1; i < n; i++) {
		len1 += dist[i];
	}
//	cout << len1 << '\t' << len2 << '\t' << mins << '\n';
	mins = min(mins, len1 * len2);
	for (int i = 1; i < n - 1; i++) {
		len1 -= dist[i];
		len1 += dist[i + n - 1];
		mins = min(mins, len1 * len2);
//		cout << len1 << '\t' << len2 << '\t' << mins << '\n';
	}
	cout << mins << '\n';
	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

const int MAXN = 1e5 + 5;
int record[2 * MAXN];
int n, ans;

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


#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

const ll INF = 1ll << 60;
const int MAXN = 1e5 + 5;
int n;
ll record[2 * MAXN];
ll dist[2 * MAXN];
ll len1, len2, mins;

void getdist(int bg, int nd) {
	len1 = 0;
	for (int i = bg; i < nd; i++) {
		len1 += dist[i];
	}
}

int main() {
	cin >> n;
	for (int i = 0; i < 2 * n; i++) {
		cin >> record[i];
	}
	sort(record, record + 2 * n);
	for (int i = 0; i < 2 * n - 1; i++) {
		dist[i] = record[i + 1] - record[i];
	}
	mins = (record[n - 1] - record[0]) * (record[2 * n - 1] - record[n]);
	len2 = record[2 * n - 1] - record[0];
	for (int i = 1; i < n; i++) {
		getdist(i, i + n - 1);
		mins = min(mins, len1 * len2);
	}
	cout << mins << '\n';
	return 0;
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#define inf 0x7f7f7f7f7f
typedef long long ll;
using namespace std;

const int MAXN = 200005;
int a[MAXN];

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


# include<cstdio>
# include<cstring>
# include<algorithm>
using namespace std;
const int N = 2e5 + 5;
typedef long long ll;
int a[N];
int n;
int main()
{
	scanf("%d",&n); n <<= 1;
	for (int i = 1 ; i <= n ; ++i) scanf("%d",&a[i]);
	sort(a + 1,a + n + 1);
	ll ans = (ll)(a[n / 2] - a[1]) * (a[n] - a[n / 2 + 1]);
	ans = min(ans,(ll)(a[n / 2 + 1] - a[1]) * (a[n] - a[n / 2]));
	for (int i = n / 2 + 1 ; i < n ; ++i)
	{
		int l = i - n / 2 + 1;
		ans = min(ans,(ll)(a[i] - a[l]) * (a[n] - a[1]));
	}
	printf("%I64d\n",ans);
	return 0;
}


#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=2e5+5;
int n;
ll a[N];
inline void init(){
	scanf("%d",&n);
	for (int i=1;i<=n<<1;i++){
		scanf("%I64d",&a[i]);
	}
}
ll ans;
inline void solve(){
	sort(a+1,a+1+(n<<1));
	ans=(a[n]-a[1])*(a[n<<1]-a[n+1]);
	for (int i=2;i<=n+1;i++){
		ans=min(ans,(a[n<<1]-a[1])*(a[i+n-1]-a[i]));
	}
	printf("%I64d\n",ans);
}
int main(){
	init();
	solve();
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

#define MAXN 500005
#define INF 0x7f7f7f7f

typedef long long ll;

using namespace std;

int N;
ll ans;
ll a[MAXN];

inline int read_int()
{
	int ret = 0, f = 1; char c = getchar();
	while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
	while(c >= '0' && c <= '9') {ret = (ret << 1) + (ret << 3) + int(c - 48); c = getchar();}
	return ret * f;
}

int main()
{
	N = read_int();
	for(int i = 1; i <= 2 * N; i++)
	{
		a[i] = read_int();
	}
	sort(a + 1, a + 2 * N + 1);
	ll gap = a[2 * N] - a[1];
	ll mingap = INF;
	for(int i = 2; i <= N; i++)
		mingap = min(mingap, a[i + N - 1] - a[i]);
	ans = mingap * gap;
	ans = min(ans, (a[N] - a[1]) * (a[N * 2] - a[N + 1]));
	printf("%lld\n", ans);
	return 0;
}


#include <bits/stdc++.h>

const int MaxN = 100010 * 2;
long long a[MaxN];

int main()
{
    int n;
    scanf("%d", &n);
    for(int i = 1; i <= 2 * n; i++)
    {
        scanf("%I64d", &a[i]);
    }
    std::sort(a + 1, a + 2 * n + 1);
    long long d = 0x7fffffff;
    for(int i = n + 1; i < 2 * n; i++)
    {
        d = std::min(d, a[i] - a[i - n + 1]);
    }
    printf("%I64d", std::min(1ll * d * (a[n + n] - a[1]), 1ll * (a[n] - a[1]) * (a[n + n] - a[n + 1])));
    return 0;
}


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

typedef long long ll;
const int MAX=100005;

int n;
int a[MAX<<1];

int main()
{
//	freopen("input.txt","r",stdin);
	scanf("%d",&n);
	for(int i=1;i<=n*2;i++)
		scanf("%d",&a[i]);

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

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

	printf("%I64d\n",ans);
	return 0;
}


//
//  main.cpp
//  Round 500
//
//  Created by 王之坤 on 2018/7/30.
//  Copyright © 2018年 王之坤. All rights reserved.
//

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


//
//  main.cpp
//  Round 500
//
//  Created by 王之坤 on 2018/7/30.
//  Copyright © 2018年 王之坤. All rights reserved.
//

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


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll a[200005];
#define INF 0x7fffffff
int main()
{
	ll m;
	cin>>m;
	for(ll i=1;i<=m*2;i++)
	{
		scanf("%lld",&a[i]);
	}
	sort(a+1,a+m*2+1);
	ll ans=(a[m]-a[1])*(a[2*m]-a[m+1]);
	for(ll i=2;i<=m;i++)
	{
		ans=min(ans,(a[i+m-1]-a[i])*(a[m*2]-a[1]));
	}
	cout<<ans<<endl;;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll a[200005];
#define INF 0x7fffffff
int main()
{
	ll m;
	cin>>m;
	for(int i=1;i<=m*2;i++)
	{
		scanf("%lld",&a[i]);
	}
	sort(a+1,a+m*2+1);
	ll ans1=INF;
	for(int i=2;i<m;i++)
	{
		ans1=min(ans1,a[i+m-1]-a[i]);
	}
	ans1*=(a[2*m]-a[1]);
	ll ans2=(a[m]-a[1])*(a[2*m]-a[m+1]);
	cout<<min(ans1,ans2)<<endl;;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll a[200005];
#define INF 0x7fffffff
int main()
{
	ll m;
	cin>>m;
	for(int i=1;i<=m*2;i++)
	{
		scanf("%lld",&a[i]);
	}
	sort(a+1,a+m*2+1);
	ll ans1=INF;
	for(int i=2;i<m;i++)
	{
		ans1=min(ans1,a[i+m-1]-a[i]);
	}
	ll ans2=(a[m]-a[1])*(a[2*m]-a[m+1]);
	cout<<min(ans1,ans2)<<endl;;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll a[200005];
#define INF 0x7fffffff
///////////////////////////
int main()
{
	ll m;
	cin>>m;
	for(ll i=1;i<=m*2;i++)
	{
		scanf("%I64d",&a[i]);
	}
	sort(a+1,a+m*2+1);
	ll ans=(a[m]-a[1])*(a[2*m]-a[m+1]);
	for(ll i=2;i<=m;i++)
	{
		ans=min(ans,(a[i+m-1]-a[i])*(a[m*2]-a[1]));
	}
	cout<<ans<<endl;;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
//dfbhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhk
ll a[200005];
#define INF 0x7fffffff
int main()
{
	ll m;
	cin>>m;
	for(int i=1;i<=m*2;i++)
	{
		scanf("%lld",&a[i]);
	}
	sort(a+1,a+m*2+1);
	ll ans1=INF;
	for(int i=2;i<m;i++)
	{
		ans1=min(ans1,a[i+m-1]-a[i]);
	}
	ll ans2=(a[m]-a[1])*(a[2*m]-a[m+1]);
	cout<<min(ans1,ans2)<<endl;;
	return 0;
}


#include<iostream>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;

long long minn;
long long a[1000005];
int main()
{
	int n;
	scanf("%d", &n);

	for(int i=0;i<2*n;i++)
	{
		scanf("%lld", &a[i]);
	}

	sort(a, a + 2 * n);

	minn = (a[2 * n - 1] - a[n])*(a[n - 1] - a[0]);
	for (int i = 0; i < n; i++)
	{
		minn = min(minn, (a[2 * n - 1] - a[0])*(a[i+n-1]-a[i]));
	}
	printf("%lld\n", minn);
}


#include<iostream>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;

long long minn;
long long a[100005];
int main()
{
	int n;
	scanf("%d", &n);

	for(int i=0;i<2*n;i++)
	{
		scanf("%lld", &a[i]);
	}

	sort(a, a + 2 * n);

	minn = (a[2 * n - 1] - a[n])*(a[n - 1] - a[0]);
	for (int i = 0; i < n; i++)
	{
		minn = min(minn, (a[2 * n - 1] - a[0])*(a[i+n-1]-a[i]));
	}
	printf("%lld\n", minn);
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define re register int
using namespace std;
const int MAX=1e5+5;
char ss[1<<17],*A=ss,*B=ss;
inline char gc(){if(A==B){B=(A=ss)+fread(ss,1,1<<17,stdin);if(A==B)return EOF;}return *A++;}
template<class T>inline void read(T&x){
    char c;re y=1;while(c=gc(),c<48||57<c)if(c=='-')y=-1;x=c^48;
    while(c=gc(),47<c&&c<58)x=(x<<1)+(x<<3)+(c^48);x*=y;
}
long long n;
long long a[2*MAX];
long long xa,xb,ya,yb,minn=1e18;
int main()
{
	read(n);
	for(int i=1;i<=2*n;i++)read(a[i]);
	sort(a+1,a+2*n+1);
	xa=a[1],yb=a[2*n];
	xb=a[n],ya=a[n+1];
	for(int i=2;i<=n+1;i++)minn=min(minn,a[i+n-1]-a[i]);
	cout<<min((ll)((yb-ya)*(xb-xa)),(ll)(minn*(a[2*n]-a[1])));
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define re register int
using namespace std;
const int MAX=1e5+5;
char ss[1<<17],*A=ss,*B=ss;
inline char gc(){if(A==B){B=(A=ss)+fread(ss,1,1<<17,stdin);if(A==B)return EOF;}return *A++;}
template<class T>inline void read(T&x){
    char c;re y=1;while(c=gc(),c<48||57<c)if(c=='-')y=-1;x=c^48;
    while(c=gc(),47<c&&c<58)x=(x<<1)+(x<<3)+(c^48);x*=y;
}
long long n;
long long a[2*MAX];
long long xa,xb,ya,yb,minn=1e18;
int main()
{
	read(n);
	for(int i=1;i<=2*n;i++)read(a[i]);
	sort(a+1,a+2*n+1);
	xa=a[1],yb=a[2*n];
	xb=a[n],ya=a[n+1];
	for(int i=2;i<=n+1;i++)minn=min(minn,a[i+n-1]-a[i]);
	cout<<min((yb-ya)*(xb-xa),minn*(a[2*n]-a[1]));
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define re register int
using namespace std;
const int MAX=1e5+5;
char ss[1<<17],*A=ss,*B=ss;
inline char gc(){if(A==B){B=(A=ss)+fread(ss,1,1<<17,stdin);if(A==B)return EOF;}return *A++;}
template<class T>inline void read(T&x){
    char c;re y=1;while(c=gc(),c<48||57<c)if(c=='-')y=-1;x=c^48;
    while(c=gc(),47<c&&c<58)x=(x<<1)+(x<<3)+(c^48);x*=y;
}
long long n;
long long a[MAX];
long long xa,xb,ya,yb,minn=1e18;
int main()
{
	read(n);
	for(int i=1;i<=2*n;i++)read(a[i]);
	sort(a+1,a+2*n+1);
	xa=a[1],yb=a[2*n];
	xb=a[n],ya=a[n+1];
	for(int i=2;i<=n+1;i++)minn=min(minn,a[i+n-1]-a[i]);
	cout<<min((ll)((yb-ya)*(xb-xa)),(ll)(minn*(a[2*n]-a[1])));
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define re register int
#define long long ll
using namespace std;
const int MAX=1e5+5;
char ss[1<<17],*A=ss,*B=ss;
inline char gc(){if(A==B){B=(A=ss)+fread(ss,1,1<<17,stdin);if(A==B)return EOF;}return *A++;}
template<class T>inline void read(T&x){
    char c;re y=1;while(c=gc(),c<48||57<c)if(c=='-')y=-1;x=c^48;
    while(c=gc(),47<c&&c<58)x=(x<<1)+(x<<3)+(c^48);x*=y;
}
long long n;
long long a[MAX];
long long xa,xb,ya,yb,minn=1e18;
int main()
{
	read(n);
	for(int i=1;i<=2*n;i++)read(a[i]);
	sort(a+1,a+2*n+1);
	xa=a[1],yb=a[2*n];
	xb=a[n],ya=a[n+1];
	for(int i=2;i<=n+1;i++)minn=min(minn,a[i+n-1]-a[i]);
	cout<<min((ll)((yb-ya)*(xb-xa)),(ll)(minn*(a[2*n]-a[1])));
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define re register int
using namespace std;
const int MAX=1e5+5;
char ss[1<<17],*A=ss,*B=ss;
inline char gc(){if(A==B){B=(A=ss)+fread(ss,1,1<<17,stdin);if(A==B)return EOF;}return *A++;}
template<class T>inline void read(T&x){
    char c;re y=1;while(c=gc(),c<48||57<c)if(c=='-')y=-1;x=c^48;
    while(c=gc(),47<c&&c<58)x=(x<<1)+(x<<3)+(c^48);x*=y;
}
int n;
long long a[MAX];
long long xa,xb,ya,yb,minn=2147483647;
int main()
{
	read(n);
	for(int i=1;i<=2*n;i++)read(a[i]);
	sort(a+1,a+2*n+1);
	xa=a[1],yb=a[2*n];
	xb=a[n],ya=a[n+1];
	for(int i=2;i<=n+1;i++)minn=min(minn,a[i+n-1]-a[i]);
	cout<<min((yb-ya)*(xb-xa),minn*(a[2*n]-a[1]));
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define re register int
using namespace std;
const int MAX=1e5+5;
char ss[1<<17],*A=ss,*B=ss;
inline char gc(){if(A==B){B=(A=ss)+fread(ss,1,1<<17,stdin);if(A==B)return EOF;}return *A++;}
template<class T>inline void read(T&x){
    char c;re y=1;while(c=gc(),c<48||57<c)if(c=='-')y=-1;x=c^48;
    while(c=gc(),47<c&&c<58)x=(x<<1)+(x<<3)+(c^48);x*=y;
}
long long n;
long long a[MAX];
long long xa,xb,ya,yb,minn=1e18;
int main()
{
	read(n);
	for(int i=1;i<=2*n;i++)read(a[i]);
	sort(a+1,a+2*n+1);
	xa=a[1],yb=a[2*n];
	xb=a[n],ya=a[n+1];
	for(int i=2;i<=n+1;i++)minn=min(minn,a[i+n-1]-a[i]);
	cout<<min((yb-ya)*(xb-xa),minn*(a[2*n]-a[1]));
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<queue>
using namespace std;
const int Maxn=2e5+10;
int n, a[Maxn];
long long ans;

int read(){
	int out=0, f=1; char c=getchar(); while(c < '0' || c > '9') {if(c == '-') f=-1; c=getchar();}
	while(c >= '0' && c <= '9') {out=(out<<1)+(out<<3)+c-'0'; c=getchar();} return out*f;
}

void solve(){
	n=read();
	for(int i=1; i <= n*2; i++) a[i]=read();
	sort(a+1, a+1+n*2); ans=1ll*(a[n*2]-a[n+1])*(a[n]-a[1]);
	for(int i=2; i <= n; i++) ans=min(ans, 1ll*(a[n*2]-a[1])*(a[i+n-1]-a[i]));
	printf("%I64d", ans);
}

int main(){solve(); return 0;}


#include<bits/stdc++.h>//
#define maxn 200007
#define inf 1e18
#define ll long long int
using namespace std;

ll a[maxn];

inline ll read()
{
	ll 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;
}

inline void writ(ll x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>9) writ(x/10);
	putchar(x%10+'0');
}
inline void write(ll x){writ(x);putchar('\n');}

int main()
{
	ll n=read(),ans=inf;
	for (int i=1;i<=2*n;++i) a[i]=read();
	sort(a+1,a+2*n+1);
	ans=(a[n]-a[1])*(a[2*n]-a[n+1]);
	for (int i=2;i<=n;++i) ans=min(ans,(a[2*n]-a[1])*(a[i+n-1]-a[i]));
	write(ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int INF=0x3f3f3f3f;
const int size=1e5+5;
int arr[2*size];
int main()
{
	int n;
	while(cin>>n)
	{
		int i;
		for(i=0;i<2*n;i++)
		{
			scanf("%d",&arr[i]);
		}
		sort(arr,arr+2*n);
		long long a=arr[n-1]-arr[0];
		long long b=arr[2*n-1]-arr[n];
		long long minn=a*b;
		a=arr[2*n-1]-arr[0];
		for(int i=1;i<n;i++)
		{
			b=arr[i+n-1]-arr[i];
			minn=min(minn,a*b);
		}
		cout<<minn<<endl;
	}
}


#include <bits/stdc++.h>
#define pii pair<ll,ll>
#define pb push_back
#define maxn 300300
#define ll long long
#define debug
using namespace std;

ll a[2*maxn];

main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<2*n;i++)
        scanf("%lld",a+i);
    sort(a,a+2*n);
    ll ans = (a[n-1] - a[0]) * (a[2*n-1] - a[n]);
    for(int i=1;i<n;i++){
        ans = min(ans,(a[2*n-1]-a[0]) * (a[i+n-1] - a[i]));
    }
    printf("%lld\n",ans);
}


#include <bits/stdc++.h>

using namespace std;
int read()
{
    int x=0,f=1;char c=getchar();
    while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
    while (c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
    return x*f;
}
#define N 100010
int n,a[N<<1];
int main()
{
    n=read();
    for (int i=1;i<=n*2;i++) a[i]=read();
    sort(a+1,a+n*2+1);
    long long ans=1ll*(a[n]-a[1])*(a[n*2]-a[n+1]);
    for (int i=2;i<=n;i++) ans=min(ans,1ll*(a[n*2]-a[1])*(a[n+i-1]-a[i]));
    cout<<ans;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>

using namespace std;

const int maxn = 2e5 + 5;

int n, m;

long long a[maxn];

long long ans = 1e18 + 1;

int read(){
	int x;
	scanf("%d", &x);
	return x;
}

int main(){
	int i, j;

	n = read();

	for(i=1;i<=2*n;i++){
		cin >> a[i];
	}

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

	ans = (a[n] - a[1]) * (a[2 * n] - a[n + 1]);

	printf("%I64d\n", ans);

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>

using namespace std;

const int maxn = 2e5 + 5;

int n, m;

long long a[maxn];

long long ans = 1e18 + 1;

int read(){
	int x;
	scanf("%d", &x);
	return x;
}

int main(){
	int i, j;

	n = read();

	for(i=1;i<=2*n;i++){
		cin >> a[i];
	}

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

	ans = (a[n] - a[1]) * (a[2 * n] - a[n + 1]);

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

	printf("%I64d\n", ans);

	return 0;
}


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


#include<bits/stdc++.h>
using namespace std;
const int Maxn=200001;
const long long Inf=1e18;
long long a[Maxn];
int n;

void init(){
	scanf("%d",&n);
	for(int i=1;i<=n*2;++i)scanf("%I64d",&a[i]);
	sort(a+1,a+n*2+1);
}

void solve(){
	long long ans1,minv=Inf;

	minv=(a[n]-a[1])*(a[2*n]-a[n+1]);
	for(int i=2;i<=n;++i){
		ans1=(a[i+n-1]-a[i])*(a[2*n]-a[1]);
		minv=minv>ans1?ans1:minv;
	}
	printf("%I64d\n",minv);
}

int main(){
	init();
	solve();
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n;
	cin>>n;
	vector<ll> a(n * 2);
	for(ll i = 0;i < n * 2; ++i)
	{
		cin>>a[i];
	}
	sort(a.begin(),a.end());
	ll ans = (a[n - 1] - a[0]) * (a[2 * n - 1] - a[n]);
	for(ll i = 1;i < n; ++i)
	{
		ans = min(ans,(a[n + i - 1] - a[i]) * (a[2 * n - 1] - a[0]));
	}
	cout<<ans<<endl;
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {
    int N, K; cin >> N >> K;
    vector<int> H(N);
    vector<int> cnt(2e5+1);
    int mx = 0;
    int mn = 2e5;
    for(int &h:H){
        cin >> h;
        cnt[h]++;
        mx = max(mx, h);
        mn = min(mn, h);
    }

    int c = 0;
    ll sum = 0;
    int ans = 0;
    for(int i=mx; i>=mn; i--){
        c += cnt[i+1];
        if(sum - i * c > K){
            ans++;
            i++;
            sum -= (i+1) * c;
        }else{
            sum += i * cnt[i];
        }
    }

    if(mx==mn) cout << 0 << endl;
    else cout << ++ans << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {
    int N, K; cin >> N >> K;
    vector<int> H(N);
    vector<int> cnt(2e5+2);
    int mx = 0;
    int mn = 2e5;
    for(int &h:H){
        cin >> h;
        cnt[h]++;
        mx = max(mx, h);
        mn = min(mn, h);
    }

    int c = 0;
    ll sum = 0;
    int ans = 0;
    for(int i=mx; i>=mn; i--){
        c += cnt[i+1];
        sum += (i+1) * cnt[i+1];

        if(sum - i * c > K){
            sum = 1LL * (i+1) * c - (i+1) * cnt[i+1];
            c -= cnt[i+1];
            ans++;
            i++;
        }
    }

    if(mx==mn) cout << 0 << endl;
    else cout << ++ans << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {
    int N, K; cin >> N >> K;
    vector<int> H(N);
    vector<int> cnt(2e5+1);
    int mx = 0;
    int mn = 2e5;
    for(int &h:H){
        cin >> h;
        cnt[h]++;
        mx = max(mx, h);
        mn = mn(mn, h);
    }

    int c = 0;
    ll sum = 0;
    int ans = 0;
    for(int i=mx; i>=mn; i--){
        c += cnt[i+1];
        if(sum - i * c > K){
            ans++;
            i++;
            sum -= (i+1) * c;
        }else{
            sum += i * cnt[i];
        }
    }

    if(mx==mn) cout << 0 << endl;
    else cout << ++ans << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {
    int N, K; cin >> N >> K;
    vector<int> H(N);
    vector<int> cnt(2e5+2);
    int mx = 0;
    int mn = 2e5;
    for(int &h:H){
        cin >> h;
        cnt[h]++;
        mx = max(mx, h);
        mn = min(mn, h);
    }

    int c = 0;
    ll sum = 0;
    int ans = 0;
    for(int i=mx; i>=mn; i--){
        c += cnt[i+1];
        sum += 1LL * (i+1) * cnt[i+1];

        if(sum - 1LL * i * c > K){
            sum = 1LL * (i+1) * c - 1LL * (i+1) * cnt[i+1];
            c -= cnt[i+1];
            ans++;
            i++;
        }
    }

    if(mx==mn) cout << 0 << endl;
    else cout << ++ans << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <stack>
#define N 200005
#define mod 1000000007
#define int long long
using namespace std;

int n, k, a[N], sum[N];
int Max = -1000000000005, Min = 1000000000005;

signed main(void) {
	scanf("%lld%lld", &n, &k);
	for(int i=1; i<=n; i++) {
		scanf("%lld", &a[i]);
		Max = max(Max, a[i]);
		Min = min(Min, a[i]);
	}
	sort(a+1, a+n+1);
	for(int i=1; i<=n; i++) sum[i] = sum[i-1] + a[i];
	int cur = n+1, tot = 100000000000000, ans = 0;
	for(int h=Max; h>=Min; h--) {
		int res = lower_bound(a+1, a+n+1, h) - a;
		if(res == n+1) continue;
		int num = sum[cur-1]-sum[res-1]-(cur-res)*h + (n-res+1)*tot-(n-res+1)*h;
		//cout<< h<< ' '<< num<<' '<< res<<  '\n';
		if(num > k) {
			ans++;
			cur = res;
			tot = h;
		}
	}
	cout<< ans;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <stack>
#define N 200005
#define mod 1000000007
#define int long long
using namespace std;

int n, k, a[N], sum[N];
int Max = -1000000000005, Min = 1000000000005;

signed main(void) {
	scanf("%lld%lld", &n, &k);
	for(int i=1; i<=n; i++) {
		scanf("%lld", &a[i]);
		Max = max(Max, a[i]);
		Min = min(Min, a[i]);
	}
	sort(a+1, a+n+1);
	int flag = 0;
	for(int i=2; i<=n; i++) if(a[i] != a[i-1]) flag = 1;
	if(flag == 0) {
		cout<< 0;
		return 0;
	}
	for(int i=1; i<=n; i++) sum[i] = sum[i-1] + a[i];
	int cur = n+1, tot = 0, ans = 0;
	for(int h=200005; h>=1; h--) {
		int res = lower_bound(a+1, a+n+1, h-1) - a;
		if(res == n+1) continue;
		int num = sum[cur-1]-sum[res-1]-(cur-res)*(h-1) + (n-cur+1)*tot-(n-cur+1)*(h-1);
		//cout<< h<< ' '<< num<<' '<< res<<  '\n';
		if(num > k) {
			ans++;
			cur = lower_bound(a+1, a+n+1, h) - a;
			tot = h;
			if(tot <= Min) break;
		}
	}
	if(tot > Min) ans++;
	cout<< ans;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <stack>
#define N 200005
#define mod 1000000007
#define int long long
using namespace std;

int n, k, a[N], sum[N];
int Max = -1000000000005, Min = 1000000000005;

signed main(void) {
	scanf("%lld%lld", &n, &k);
	for(int i=1; i<=n; i++) {
		scanf("%lld", &a[i]);
		Max = max(Max, a[i]);
		Min = min(Min, a[i]);
	}
	sort(a+1, a+n+1);
	for(int i=1; i<=n; i++) sum[i] = sum[i-1] + a[i];
	int cur = n+1, tot = 100000000000005, ans = 1;
	for(int h=Max; h>=Min; h--) {
		int res = lower_bound(a+1, a+n+1, h) - a;
		if(res == n+1) continue;
		int num = sum[cur-1]-sum[res-1]-(cur-res)*h + (n-cur+1)*tot-(n-cur+1)*h;
		//cout<< h<< ' '<< num<<' '<< res<<  '\n';
		if(num > k) {
			ans++;
			cur = res;
			tot = h;
		}
	}
	cout<< ans;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <stack>
#define N 200005
#define mod 1000000007
#define int long long
using namespace std;

int n, k, a[N], sum[N];
int Max = -1000000005, Min = 1000000005;

signed main(void) {
	scanf("%lld%lld", &n, &k);
	for(int i=1; i<=n; i++) {
		scanf("%lld", &a[i]);
		Max = max(Max, a[i]);
		Min = min(Min, a[i]);
	}
	sort(a+1, a+n+1);
	for(int i=1; i<=n; i++) sum[i] = sum[i-1] + a[i];
	int cur = n+1, tot = 10000000000, ans = 0;
	for(int h=Max_; h>=Min_; h--) {
		int res = lower_bound(a+1, a+n+1, h) - a;
		if(res == n+1) continue;
		int num = sum[cur-1]-sum[res-1]-(cur-res)*h + (n-res+1)*tot-(n-res+1)*h;
		//cout<< h<< ' '<< num<<' '<< res<<  '\n';
		if(num > k) {
			ans++;
			cur = res;
			tot = h;
		}
	}
	cout<< ans;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <stack>
#define N 200005
#define mod 1000000007
#define int long long
using namespace std;

int n, k, a[N], sum[N];
int Max = -1000000005, Min = 1000000005;

signed main(void) {
	scanf("%lld%lld", &n, &k);
	for(int i=1; i<=n; i++) {
		scanf("%lld", &a[i]);
		Max = max(Max, a[i]);
		Min = min(Min, a[i]);
	}
	sort(a+1, a+n+1);
	for(int i=1; i<=n; i++) sum[i] = sum[i-1] + a[i];
	int cur = n+1, tot = 10000000000, ans = 0;
	for(int h=Max; h>=Min; h--) {
		int res = lower_bound(a+1, a+n+1, h) - a;
		if(res == n+1) continue;
		int num = sum[cur-1]-sum[res-1]-(cur-res)*h + (n-res+1)*tot-(n-res+1)*h;
		//cout<< h<< ' '<< num<<' '<< res<<  '\n';
		if(num > k) {
			ans++;
			cur = res;
			tot = h;
		}
	}
	cout<< ans;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <stack>
#define N 200005
#define mod 1000000007
#define int long long
using namespace std;

int n, k, a[N], sum[N];
int Max = -1000000000005, Min = 1000000000005;

signed main(void) {
	scanf("%lld%lld", &n, &k);
	for(int i=1; i<=n; i++) {
		scanf("%lld", &a[i]);
		Max = max(Max, a[i]);
		Min = min(Min, a[i]);
	}
	sort(a+1, a+n+1);
	for(int i=1; i<=n; i++) sum[i] = sum[i-1] + a[i];
	int cur = n+1, tot = 100000000000005, ans = 0;
	for(int h=200005; h>=1; h--) {
		int res = lower_bound(a+1, a+n+1, h-1) - a;
		if(res == n+1) continue;
		int num = sum[cur-1]-sum[res-1]-(cur-res)*(h-1) + (n-cur+1)*tot-(n-cur+1)*(h-1);
		//cout<< h<< ' '<< num<<' '<< res<<  '\n';
		if(num > k) {
			ans++;
			cur = lower_bound(a+1, a+n+1, h) - a;
			tot = h;
			if(tot <= Min) break;
		}
	}
	if(tot > Min) ans++;
	cout<< ans;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <stack>
#define N 200005
#define mod 1000000007
#define int long long
using namespace std;

int n, k, a[N], sum[N];
int Max = -1000000000005, Min = 1000000000005;

signed main(void) {
	scanf("%lld%lld", &n, &k);
	for(int i=1; i<=n; i++) {
		scanf("%lld", &a[i]);
		Max = max(Max, a[i]);
		Min = min(Min, a[i]);
	}
	sort(a+1, a+n+1);
	for(int i=1; i<=n; i++) sum[i] = sum[i-1] + a[i];
	int cur = n+1, tot = 100000000000005, ans = 1;
	for(int h=Max; h>=Min; h--) {
		int res = lower_bound(a+1, a+n+1, h) - a;
		if(res == n+1) continue;
		int num = sum[cur-1]-sum[res-1]-(cur-res)*h + (n-cur+1)*tot-(n-cur+1)*h;
		cout<< h<< ' '<< num<<' '<< res<<  '\n';
		if(num > k) {
			ans++;
			cur = res;
			tot = h;
		}
	}
	cout<< ans;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <stack>
#define N 200005
#define mod 1000000007
#define int long long
using namespace std;

int n, k, a[N], sum[N];
int Max = -1000000000005, Min = 1000000000005;

signed main(void) {
	scanf("%lld%lld", &n, &k);
	for(int i=1; i<=n; i++) {
		scanf("%lld", &a[i]);
		Max = max(Max, a[i]);
		Min = min(Min, a[i]);
	}
	sort(a+1, a+n+1);
	for(int i=1; i<=n; i++) sum[i] = sum[i-1] + a[i];
	int cur = n+1, tot = 100000000000005, ans = 0;
	for(int h=200005; h>=1; h--) {
		int res = lower_bound(a+1, a+n+1, h-1) - a;
		if(res == n+1) continue;
		int num = sum[cur-1]-sum[res-1]-(cur-res)*(h-1) + (n-cur+1)*tot-(n-cur+1)*(h-1);
		//cout<< h<< ' '<< num<<' '<< res<<  '\n';
		if(num > k) {
			ans++;
			cur = lower_bound(a+1, a+n+1, h) - a;
			tot = h;
			if(tot <= Min) break;
		}
	}
	cout<< ans;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <stack>
#define N 200005
#define mod 1000000007
#define int long long
using namespace std;

int n, k, a[N], sum[N];
int Max = -1000000000005, Min = 1000000000005;

signed main(void) {
	scanf("%lld%lld", &n, &k);
	for(int i=1; i<=n; i++) {
		scanf("%lld", &a[i]);
		Max = max(Max, a[i]);
		Min = min(Min, a[i]);
	}
	sort(a+1, a+n+1);
	for(int i=1; i<=n; i++) sum[i] = sum[i-1] + a[i];
	int cur = n+1, tot = 100000000000005, ans = 0;
	for(int h=Max; h>=Min; h--) {
		int res = lower_bound(a+1, a+n+1, h-1) - a;
		if(res == n+1) continue;
		int num = sum[cur-1]-sum[res-1]-(cur-res)*(h-1) + (n-cur+1)*tot-(n-cur+1)*(h-1);
		//cout<< h<< ' '<< num<<' '<< res<<  '\n';
		if(num > k) {
			ans++;
			cur = lower_bound(a+1, a+n+1, h) - a;
			tot = h;
		}
	}
	cout<< ans;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <stack>
#define N 200005
#define mod 1000000007
#define int long long
using namespace std;

int n, k, a[N], sum[N];
int Max = -1000000000005, Min = 1000000000005;

signed main(void) {
	scanf("%lld%lld", &n, &k);
	for(int i=1; i<=n; i++) {
		scanf("%lld", &a[i]);
		Max = max(Max, a[i]);
		Min = min(Min, a[i]);
	}
	sort(a+1, a+n+1);
	for(int i=1; i<=n; i++) sum[i] = sum[i-1] + a[i];
	int cur = n+1, tot = 100000000000000, ans = 0;
	for(int h=Max; h>=Min; h--) {
		int res = lower_bound(a+1, a+n+1, h) - a;
		if(res == n+1) continue;
		int num = sum[cur-1]-sum[res-1]-(cur-res)*h + (n-cur+1)*tot-(n-cur+1)*h;
		//cout<< h<< ' '<< num<<' '<< res<<  '\n';
		if(num > k) {
			ans++;
			cur = res;
			tot = h;
		}
	}
	cout<< ans;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <stack>
#define N 200005
#define mod 1000000007
#define int long long
using namespace std;

int n, k, a[N], sum[N];
int Max = -1000000000005, Min = 1000000000005;

signed main(void) {
	scanf("%lld%lld", &n, &k);
	for(int i=1; i<=n; i++) {
		scanf("%lld", &a[i]);
		Max = max(Max, a[i]);
		Min = min(Min, a[i]);
	}
	sort(a+1, a+n+1);
	for(int i=1; i<=n; i++) sum[i] = sum[i-1] + a[i];
	int cur = n+1, tot = 100000000000005, ans = 0;
	for(int h=Max; h>=1; h--) {
		int res = lower_bound(a+1, a+n+1, h-1) - a;
		if(res == n+1) continue;
		int num = sum[cur-1]-sum[res-1]-(cur-res)*(h-1) + (n-cur+1)*tot-(n-cur+1)*(h-1);
		//cout<< h<< ' '<< num<<' '<< res<<  '\n';
		if(num > k) {
			ans++;
			cur = lower_bound(a+1, a+n+1, h) - a;
			tot = h;
			if(tot <= Min) break;
		}
	}
	cout<< ans;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <stack>
#define N 200005
#define mod 1000000007
#define int long long
using namespace std;

int n, k, a[N], sum[N];
int Max = -1000000000005, Min = 1000000000005;

signed main(void) {
	scanf("%lld%lld", &n, &k);
	for(int i=1; i<=n; i++) {
		scanf("%lld", &a[i]);
		Max = max(Max, a[i]);
		Min = min(Min, a[i]);
	}
	sort(a+1, a+n+1);
	int flag = 0;
	for(int i=2; i<=n; i++) if(a[i] != a[i-1]) flag = 1;
	if(flag == 0) {
		cout<< 0;
		return 0;
	}
	for(int i=1; i<=n; i++) sum[i] = sum[i-1] + a[i];
	int cur = n+1, tot = 0, ans = 0;
	for(int h=200005; h>=Min; h--) {
		int res = lower_bound(a+1, a+n+1, h-1) - a;
		if(res == n+1) continue;
		int num = sum[cur-1]-sum[res-1]-(cur-res)*(h-1) + (n-cur+1)*tot-(n-cur+1)*(h-1);
		//cout<< h<< ' '<< num<<' '<< res<<  '\n';
		if(num > k) {
			ans++;
			cur = lower_bound(a+1, a+n+1, h) - a;
			tot = h;
			//if(tot <= Min) break;
		}
	}
	if(tot != Min) ans++;
	cout<< ans;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <stack>
#define N 200005
#define mod 1000000007
#define int long long
using namespace std;

int n, k, a[N], sum[N];
int Max = -1000000000005, Min = 1000000000005;

signed main(void) {
	scanf("%lld%lld", &n, &k);
	for(int i=1; i<=n; i++) {
		scanf("%lld", &a[i]);
		Max = max(Max, a[i]);
		Min = min(Min, a[i]);
	}
	sort(a+1, a+n+1);
	/*int flag = 0;
	for(int i=2; i<=n; i++) if(a[i] != a[i-1]) flag = 1;
	if(flag == 0) {
		cout<< 0;
		return 0;
	}*/
	for(int i=1; i<=n; i++) sum[i] = sum[i-1] + a[i];
	int cur = n+1, tot = 0, ans = 0;
	for(int h=200005; h>=Min; h--) {
		int res = lower_bound(a+1, a+n+1, h-1) - a;
		if(res == n+1) continue;
		int num = sum[cur-1]-sum[res-1]-(cur-res)*(h-1) + (n-cur+1)*tot-(n-cur+1)*(h-1);
		//cout<< h<< ' '<< num<<' '<< res<<  '\n';
		if(num > k) {
			ans++;
			cur = lower_bound(a+1, a+n+1, h) - a;
			tot = h;
			//if(tot <= Min) break;
		}
	}
	if(tot != Min) ans++;
	cout<< ans;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <stack>
#define N 200005
#define mod 1000000007
#define int long long
using namespace std;

int n, k, a[N], sum[N];
int Max = -1000000000005, Min = 1000000000005;

signed main(void) {
	scanf("%lld%lld", &n, &k);
	for(int i=1; i<=n; i++) {
		scanf("%lld", &a[i]);
		Max = max(Max, a[i]);
		Min = min(Min, a[i]);
	}
	sort(a+1, a+n+1);
	for(int i=1; i<=n; i++) sum[i] = sum[i-1] + a[i];
	int cur = n+1, tot = 0, ans = 0;
	for(int h=200005; h>=1; h--) {
		int res = lower_bound(a+1, a+n+1, h-1) - a;
		if(res == n+1) continue;
		int num = sum[cur-1]-sum[res-1]-(cur-res)*(h-1) + (n-cur+1)*tot-(n-cur+1)*(h-1);
		//cout<< h<< ' '<< num<<' '<< res<<  '\n';
		if(num > k) {
			ans++;
			cur = lower_bound(a+1, a+n+1, h) - a;
			tot = h;
			if(tot <= Min) break;
		}
	}
	if(tot > Min) ans++;
	cout<< ans;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <stack>
#define N 200005
#define mod 1000000007
#define int long long
using namespace std;

int n, k, a[N], sum[N];
int Max = -1000000000005, Min = 1000000000005;

signed main(void) {
	scanf("%lld%lld", &n, &k);
	for(int i=1; i<=n; i++) {
		scanf("%lld", &a[i]);
		Max = max(Max, a[i]);
		Min = min(Min, a[i]);
	}
	sort(a+1, a+n+1);
	for(int i=1; i<=n; i++) sum[i] = sum[i-1] + a[i];
	int cur = n+1, tot = 100000000000005, ans = 0;
	for(int h=100000; h>=1; h--) {
		int res = lower_bound(a+1, a+n+1, h-1) - a;
		if(res == n+1) continue;
		int num = sum[cur-1]-sum[res-1]-(cur-res)*(h-1) + (n-cur+1)*tot-(n-cur+1)*(h-1);
		//cout<< h<< ' '<< num<<' '<< res<<  '\n';
		if(num > k) {
			ans++;
			cur = lower_bound(a+1, a+n+1, h) - a;
			tot = h;
			if(tot <= Min) break;
		}
	}
	cout<< ans;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <stack>
#define N 200005
#define mod 1000000007
using namespace std;

int n, k, a[N], sum[N];

signed main(void) {
	scanf("%d%d", &n, &k);
	for(int i=1; i<=n; i++) {
		scanf("%d", &a[i]);
	}
	sort(a+1, a+n+1);
	for(int i=1; i<=n; i++) sum[i] = sum[i-1] + a[i];
	int cur = n+1, tot = 10000000, ans = 0;
	for(int h=n; h>=1; h--) {
		int res = lower_bound(a+1, a+n+1, h) - a;
		if(res == n+1) continue;
		int num = sum[cur-1]-sum[res-1]-(cur-res)*h + (n-res+1)*tot-(n-res+1)*h;
		//cout<< h<< ' '<< num<<' '<< res<<  '\n';
		if(num > k) {
			ans++;
			cur = res;
			tot = h;
		}
	}
	cout<< ans;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <stack>
#define N 200005
#define mod 1000000007
#define int long long
using namespace std;

int n, k, a[N], sum[N];

signed main(void) {
	scanf("%lld%lld", &n, &k);
	for(int i=1; i<=n; i++) {
		scanf("%lld", &a[i]);
	}
	sort(a+1, a+n+1);
	for(int i=1; i<=n; i++) sum[i] = sum[i-1] + a[i];
	int cur = n+1, tot = 10000000000, ans = 0;
	for(int h=n; h>=1; h--) {
		int res = lower_bound(a+1, a+n+1, h) - a;
		if(res == n+1) continue;
		int num = sum[cur-1]-sum[res-1]-(cur-res)*h + (n-res+1)*tot-(n-res+1)*h;
		//cout<< h<< ' '<< num<<' '<< res<<  '\n';
		if(num > k) {
			ans++;
			cur = res;
			tot = h;
		}
	}
	cout<< ans;
}


#include<bits/stdc++.h>

#define int long long
#define pii pair<int,int>
#define fr first
#define se second
#define ll long long
#define mp make_pair
const int mod=998244353;
const int inf=(int)1e18;

using namespace std;

const int N = 2e5 + 5;
int seg1[4*N], seg2[4*N], seg3[4*N] ,lzy[4*N], arr[N];

inline void build(int node, int s, int e){
	if(s == e){
		seg1[node] = seg2[node] =seg3[node]= arr[s];
	}
	else{
		int mid = (s + e) >> 1;
		build(2*node, s , mid);
		build(2*node + 1, mid + 1, e);
		seg1[node] = seg1[2*node + 1] + seg1[2*node];
		seg2[node] = max(seg2[2*node],seg2[2*node + 1]);
				seg3[node] = max(seg3[2*node],seg3[2*node + 1]);

	}
}

inline void lazy(int node, int s, int e){
	seg1[node] = lzy[node] * (e - s +1);
	seg2[node] = lzy[node];
	seg3[node] = lzy[node];
	if(s != e){
		lzy[2*node] = lzy[node];
		lzy[2*node + 1] = lzy[node];
	}
	lzy[node] = 0;
}

inline void update(int node, int s, int e, int l, int r, int k){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return;
	if(s >= l and e <= r){
		seg1[node] = k *  (e - s +1);
		seg2[node] = k;
		seg2[node] = k;
		if(s != e){
			lzy[2*node] = k;
			lzy[2*node + 1] = k;
		}
		return;
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	update(p, s, mid, l, r, k);
	update(q, mid+1, e, l, r, k);
	seg1[node] = seg1[p] + seg1[q];
	seg2[node] = max(seg2[p],seg2[q]);
	seg3[node] = max(seg3[p],seg3[q]);
}

inline int querymax(int node, int s, int e, int l, int r){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return 0;
	if(s >= l and e <= r){
		return seg2[node];
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	return max(querymax(p, s, mid, l, r),querymax(q, mid + 1, e, l, r));
}

inline int down(int node,int s,int e,int v)
{
	if(s==e)
		return s;
	int mid = (s+e)>>1,p=node<<1,q=p|1;
	if(seg3[2*node]<v)
		return down(2*node,s,mid,v);
	else
		return down(2*node+1,mid+1,e,v);
}

inline int querymin(int node, int s, int e, int l, int r,int v){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return -1;
	if(s >= l and e <= r){
		if(seg3[node] < v){
			return down(node, s, e, v);
		}
		return -1;
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	int a=querymin(p, s, mid, l, r,v),b=querymin(q, mid + 1, e, l, r,v);
	if(a!=-1)
		return a;
	else
		return b;
}
int b1[N],b2[N];
void update(int b[],int i,int v){
	for(;i<N;i+=i&-i)
		b[i]+=v;
}
int sum(int b[],int i)
{
	int t=0;
	for(;i;i-=i&-i)
		t+=b[i];
	return t;
}
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
   	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output1.txt","w",stdout);
	#endif
	int n, k, mn = inf,mx=0;
	cin >> n >> k;
	for (int i = 1; i <= n; ++i)
	{
		cin >> arr[i];
		mn = min(arr[i], mn);
		mx=max(mx,arr[i]);
		update(b1,arr[i],arr[i]);
		update(b2,arr[i],1);
	}
	sort(arr+1,arr+n+1,greater<int>());
	int c = 0,p=0;
	for(int i=mx;i>=mn;i--)
	{
		if(i!=mn){
			int ans=sum(b1,mx)-sum(b1,i-1)-p-(i-1)*(sum(b2,mx)-sum(b2,i-1));
			if(ans>k)
			{
				c++;
				p+=sum(b1,mx)-sum(b1,i)-p-(i)*(sum(b2,mx)-sum(b2,i));
			}
		}
		else
		{
			c++;
		}
	}
	cout<<c<<"\n";
	return 0;
}


#include<bits/stdc++.h>

#define int long long
#define pii pair<int,int>
#define fr first
#define se second
#define ll long long
#define mp make_pair
const int mod=998244353;
const int inf=(int)1e18;

using namespace std;

const int N = 2e5 + 5;
int seg1[4*N], seg2[4*N], seg3[4*N] ,lzy[4*N], arr[N];

inline void build(int node, int s, int e){
	if(s == e){
		seg1[node] = seg2[node] =seg3[node]= arr[s];
	}
	else{
		int mid = (s + e) >> 1;
		build(2*node, s , mid);
		build(2*node + 1, mid + 1, e);
		seg1[node] = seg1[2*node + 1] + seg1[2*node];
		seg2[node] = max(seg2[2*node],seg2[2*node + 1]);
				seg3[node] = max(seg3[2*node],seg3[2*node + 1]);

	}
}

inline void lazy(int node, int s, int e){
	seg1[node] = lzy[node] * (e - s +1);
	seg2[node] = lzy[node];
	seg3[node] = lzy[node];
	if(s != e){
		lzy[2*node] = lzy[node];
		lzy[2*node + 1] = lzy[node];
	}
	lzy[node] = 0;
}

inline void update(int node, int s, int e, int l, int r, int k){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return;
	if(s >= l and e <= r){
		seg1[node] = k *  (e - s +1);
		seg2[node] = k;
		seg2[node] = k;
		if(s != e){
			lzy[2*node] = k;
			lzy[2*node + 1] = k;
		}
		return;
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	update(p, s, mid, l, r, k);
	update(q, mid+1, e, l, r, k);
	seg1[node] = seg1[p] + seg1[q];
	seg2[node] = max(seg2[p],seg2[q]);
	seg3[node] = max(seg3[p],seg3[q]);
}

inline int querymax(int node, int s, int e, int l, int r){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return 0;
	if(s >= l and e <= r){
		return seg2[node];
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	return max(querymax(p, s, mid, l, r),querymax(q, mid + 1, e, l, r));
}

inline int querymin(int node, int s, int e, int l, int r){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return inf;
	if(s >= l and e <= r){
		return seg3[node];
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	return min(querymin(p, s, mid, l, r),querymin(q, mid + 1, e, l, r));
}

inline int querysum(int node, int s, int e, int l, int r){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return 0;
	if(s >= l and e <= r){
		return seg1[node];
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	return querysum(p, s, mid, l, r) + querysum(q, mid + 1, e, l, r);
}

inline int bs(int k, int n){
	int lo = 1, hi = n, ans = 0;
	while(lo <= hi){
		int mid = (lo + hi) >> 1;
		if(querymin(1, 1, n, 1, mid) >= k){
			ans = mid;
			lo = mid + 1;
		}
		else{
			hi = mid - 1;
		}
	}
	return ans;
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
   	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output1.txt","w",stdout);
	#endif
	int n, k, mn = inf;
	cin >> n >> k;
	for (int i = 1; i <= n; ++i)
	{
		cin >> arr[i];
		mn = min(arr[i], mn);
	}
	sort(arr + 1, arr + n + 1, greater <int>());
	build(1, 1, n);
	int ans = 0;
	while(1){
		int lo = mn, hi = querymax(1, 1, n, 1, n), ind = -1, ind_;
		if(lo == hi){
			break;
		}
		while(lo <= hi){
			int mid = (lo + hi) >> 1;
			int ind2 = bs(mid, n);
	//		cout << ind2 << " "<< mid << " "<<querysum(1, 1, n, 1, ind2) - mid*ind2<<"\n";
			if(querysum(1, 1, n, 1, ind2) - mid*ind2 <= k){
				ind = mid;
				hi = mid - 1;
				ind_ = ind2;
			}
			else{
				lo = mid + 1;
			}
		}
	//	cout << ind << " " << ind_ << "*\n";
		//if(ans >0)return 0;
		ans++;
		update(1, 1, n, 1, ind_, ind);
	}
	cout << ans << "\n";
	return 0;
}


#include<bits/stdc++.h>

#define int long long
#define pii pair<int,int>
#define fr first
#define se second
#define ll long long
#define mp make_pair
const int mod=998244353;
const int inf=(int)1e18;

using namespace std;

const int N = 2e5 + 5;
int seg1[4*N], seg2[4*N], seg3[4*N] ,lzy[4*N], arr[N];

inline void build(int node, int s, int e){
	if(s == e){
		seg1[node] = seg2[node] =seg3[node]= arr[s];
	}
	else{
		int mid = (s + e) >> 1;
		build(2*node, s , mid);
		build(2*node + 1, mid + 1, e);
		seg1[node] = seg1[2*node + 1] + seg1[2*node];
		seg2[node] = max(seg2[2*node],seg2[2*node + 1]);
				seg3[node] = max(seg3[2*node],seg3[2*node + 1]);

	}
}

inline void lazy(int node, int s, int e){
	seg1[node] = lzy[node] * (e - s +1);
	seg2[node] = lzy[node];
	seg3[node] = lzy[node];
	if(s != e){
		lzy[2*node] = lzy[node];
		lzy[2*node + 1] = lzy[node];
	}
	lzy[node] = 0;
}

inline void update(int node, int s, int e, int l, int r, int k){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return;
	if(s >= l and e <= r){
		seg1[node] = k *  (e - s +1);
		seg2[node] = k;
		seg2[node] = k;
		if(s != e){
			lzy[2*node] = k;
			lzy[2*node + 1] = k;
		}
		return;
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	update(p, s, mid, l, r, k);
	update(q, mid+1, e, l, r, k);
	seg1[node] = seg1[p] + seg1[q];
	seg2[node] = max(seg2[p],seg2[q]);
	seg3[node] = max(seg3[p],seg3[q]);
}

inline int querymax(int node, int s, int e, int l, int r){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return 0;
	if(s >= l and e <= r){
		return seg2[node];
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	return max(querymax(p, s, mid, l, r),querymax(q, mid + 1, e, l, r));
}

inline int down(int node,int s,int e,int v)
{
	if(s==e)
		return s;
	int mid = (s+e)>>1,p=node<<1,q=p|1;
	if(seg3[2*node]<v)
		return down(2*node,s,mid,v);
	else
		return down(2*node+1,mid+1,e,v);
}

inline int querymin(int node, int s, int e, int l, int r,int v){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return -1;
	if(s >= l and e <= r){
		if(seg3[node] < v){
			return down(node, s, e, v);
		}
		return -1;
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	int a=querymin(p, s, mid, l, r,v),b=querymin(q, mid + 1, e, l, r,v);
	if(a!=-1)
		return a;
	else
		return b;
}
int b1[N],b2[N];
void update(int b[],int i,int v){
	for(;i<N;i+=i&-i)
		b[i]+=v;
}
int sum(int b[],int i)
{
	int t=0;
	for(;i;i-=i&-i)
		t+=b[i];
	return t;
}
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
   	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output1.txt","w",stdout);
	#endif
	int n, k, mn = inf,mx=0;
	cin >> n >> k;
	for (int i = 1; i <= n; ++i)
	{
		cin >> arr[i];
		mn = min(arr[i], mn);
		mx=max(mx,arr[i]);
		update(b1,arr[i],arr[i]);
		update(b2,arr[i],1);
	}
	sort(arr+1,arr+n+1,greater<int>());
	int c = 0,p=0;
	for(int i=mx;i>=mn;i--)
	{
		if(i!=mn){
			int ans=sum(b1,mx)-sum(b1,i-1)-p-(i-1)*(sum(b2,mx)-sum(b2,i-1));
			if(ans>k)
			{
				c++;
				p+=sum(b1,mx)-sum(b1,i)-p-(i)*(sum(b2,mx)-sum(b2,i));
			}
		}
		else if(sum(b1,mx)-sum(b1,i)-p-(i)*(sum(b2,mx)-sum(b2,i))!=0)
		{
			c++;
		}
	}
	cout<<c<<"\n";
	return 0;
}


#include<bits/stdc++.h>

#define int long long
#define pii pair<int,int>
#define fr first
#define se second
#define ll long long
#define mp make_pair
const int mod=998244353;
const int inf=(int)1e18;

using namespace std;

const int N = 2e5 + 5;
int seg1[4*N], seg2[4*N], seg3[4*N] ,lzy[4*N], arr[N];

inline void build(int node, int s, int e){
	if(s == e){
		seg1[node] = seg2[node] =seg3[node]= arr[s];
	}
	else{
		int mid = (s + e) >> 1;
		build(2*node, s , mid);
		build(2*node + 1, mid + 1, e);
		seg1[node] = seg1[2*node + 1] + seg1[2*node];
		seg2[node] = max(seg2[2*node],seg2[2*node + 1]);
				seg3[node] = max(seg3[2*node],seg3[2*node + 1]);

	}
}

inline void lazy(int node, int s, int e){
	seg1[node] = lzy[node] * (e - s +1);
	seg2[node] = lzy[node];
	seg3[node] = lzy[node];
	if(s != e){
		lzy[2*node] = lzy[node];
		lzy[2*node + 1] = lzy[node];
	}
	lzy[node] = 0;
}

inline void update(int node, int s, int e, int l, int r, int k){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return;
	if(s >= l and e <= r){
		seg1[node] = k *  (e - s +1);
		seg2[node] = k;
		seg2[node] = k;
		if(s != e){
			lzy[2*node] = k;
			lzy[2*node + 1] = k;
		}
		return;
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	update(p, s, mid, l, r, k);
	update(q, mid+1, e, l, r, k);
	seg1[node] = seg1[p] + seg1[q];
	seg2[node] = max(seg2[p],seg2[q]);
	seg3[node] = max(seg3[p],seg3[q]);
}

inline int querymax(int node, int s, int e, int l, int r){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return 0;
	if(s >= l and e <= r){
		return seg2[node];
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	return max(querymax(p, s, mid, l, r),querymax(q, mid + 1, e, l, r));
}

inline int down(int node,int s,int e,int v)
{
	if(s==e)
		return s;
	int mid = (s+e)>>1,p=node<<1,q=p|1;
	if(seg3[2*node]<v)
		return down(2*node,s,mid,v);
	else
		return down(2*node+1,mid+1,e,v);
}

inline int querymin(int node, int s, int e, int l, int r,int v){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return -1;
	if(s >= l and e <= r){
		if(seg3[node] < v){
			return down(node, s, e, v);
		}
		return -1;
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	int a=querymin(p, s, mid, l, r,v),b=querymin(q, mid + 1, e, l, r,v);
	if(a!=-1)
		return a;
	else
		return b;
}
int b1[N],b2[N];
void update(int b[],int i,int v){
	for(;i<N;i+=i&-i)
		b[i]+=v;
}
int sum(int b[],int i)
{
	int t=0;
	for(;i;i-=i&-i)
		t+=b[i];
	return t;
}
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
   	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output1.txt","w",stdout);
	#endif
	int n, k, mn = inf,mx=0;
	cin >> n >> k;
	for (int i = 1; i <= n; ++i)
	{
		cin >> arr[i];
		mn = min(arr[i], mn);
		mx=max(mx,arr[i]);
		update(b1,arr[i],arr[i]);
		update(b2,arr[i],1);
	}
	sort(arr+1,arr+n+1,greater<int>());
	int c = 0,p=0;
	for(int i=mx;i>=mn;i--)
	{
		if(i!=mn){
			int ans=sum(b1,mx)-sum(b1,mx-i+1)-p-(mx-i+1)*(sum(b2,mx)-sum(b2,mx-i+1));
			if(ans>k)
			{
				c++;
				p+=sum(b1,mx)-sum(b1,mx-i)-p-(mx-i)*(sum(b2,mx)-sum(b2,mx-i));
			}
		}
		else
		{
			c++;
		}
	}
	cout<<c<<"\n";
	return 0;
}


#include<bits/stdc++.h>

#define int long long
#define pii pair<int,int>
#define fr first
#define se second
#define ll long long
#define mp make_pair
const int mod=998244353;
const int inf=(int)1e18;

using namespace std;

const int N = 2e5 + 5;
int seg1[4*N], seg2[4*N], seg3[4*N] ,lzy[4*N], arr[N];

inline void build(int node, int s, int e){
	if(s == e){
		seg1[node] = seg2[node] =seg3[node]= arr[s];
	}
	else{
		int mid = (s + e) >> 1;
		build(2*node, s , mid);
		build(2*node + 1, mid + 1, e);
		seg1[node] = seg1[2*node + 1] + seg1[2*node];
		seg2[node] = max(seg2[2*node],seg2[2*node + 1]);
				seg3[node] = max(seg3[2*node],seg3[2*node + 1]);

	}
}

inline void lazy(int node, int s, int e){
	seg1[node] = lzy[node] * (e - s +1);
	seg2[node] = lzy[node];
	seg3[node] = lzy[node];
	if(s != e){
		lzy[2*node] = lzy[node];
		lzy[2*node + 1] = lzy[node];
	}
	lzy[node] = 0;
}

inline void update(int node, int s, int e, int l, int r, int k){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return;
	if(s >= l and e <= r){
		seg1[node] = k *  (e - s +1);
		seg2[node] = k;
		seg2[node] = k;
		if(s != e){
			lzy[2*node] = k;
			lzy[2*node + 1] = k;
		}
		return;
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	update(p, s, mid, l, r, k);
	update(q, mid+1, e, l, r, k);
	seg1[node] = seg1[p] + seg1[q];
	seg2[node] = max(seg2[p],seg2[q]);
	seg3[node] = max(seg3[p],seg3[q]);
}

inline int querymax(int node, int s, int e, int l, int r){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return 0;
	if(s >= l and e <= r){
		return seg2[node];
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	return max(querymax(p, s, mid, l, r),querymax(q, mid + 1, e, l, r));
}

inline int down(int node,int s,int e,int v)
{
	if(s==e)
		return s;
	int mid = (s+e)>>1,p=node<<1,q=p|1;
	if(seg3[2*node]<v)
		return down(2*node,s,mid,v);
	else
		return down(2*node+1,mid+1,e,v);
}

inline int querymin(int node, int s, int e, int l, int r,int v){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return -1;
	if(s >= l and e <= r){
		if(seg3[node] < v){
			return down(node, s, e, v);
		}
		return -1;
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	int a=querymin(p, s, mid, l, r,v),b=querymin(q, mid + 1, e, l, r,v);
	if(a!=-1)
		return a;
	else
		return b;
}

inline int querysum(int node, int s, int e, int l, int r){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return 0;
	if(s >= l and e <= r){
		return seg1[node];
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	return querysum(p, s, mid, l, r) + querysum(q, mid + 1, e, l, r);
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
   	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output1.txt","w",stdout);
	#endif
	int n, k, mn = inf;
	cin >> n >> k;
	for (int i = 1; i <= n; ++i)
	{
		cin >> arr[i];
		mn = min(arr[i], mn);
	}
	sort(arr + 1, arr + n + 1, greater <int>());
	build(1, 1, n);
	int ans = 0;
	while(1){
		int lo = mn, hi = querymax(1, 1, n, 1, n), ind = -1, ind_;
		if(lo == hi){
			break;
		}
		while(lo <= hi){
			int mid = (lo + hi) >> 1;
			int ind2 = querymin(1,1,n,1,n,mid);
			if(ind2==-1)
				ind2=n;
			else
				ind2--;
	//		cout << ind2 << " "<< mid << " "<<querysum(1, 1, n, 1, ind2) - mid*ind2<<"\n";
			if(querysum(1, 1, n, 1, ind2) - mid*ind2 <= k){
				ind = mid;
				hi = mid - 1;
				ind_ = ind2;
			}
			else{
				lo = mid + 1;
			}
		}
	//	cout << ind << " " << ind_ << "*\n";
		//if(ans >0)return 0;
		ans++;
		update(1, 1, n, 1, ind_, ind);
	}
	cout << ans << "\n";
	return 0;
}


#include<bits/stdc++.h>

#define int long long
#define pii pair<int,int>
#define fr first
#define se second
#define ll long long
#define mp make_pair
const int mod=998244353;
const int inf=(int)1e18;

using namespace std;

const int N = 2e5 + 5;
int seg1[4*N], seg2[4*N], seg3[4*N] ,lzy[4*N], arr[N];

inline void build(int node, int s, int e){
	if(s == e){
		seg1[node] = seg2[node] =seg3[node]= arr[s];
	}
	else{
		int mid = (s + e) >> 1;
		build(2*node, s , mid);
		build(2*node + 1, mid + 1, e);
		seg1[node] = seg1[2*node + 1] + seg1[2*node];
		seg2[node] = max(seg2[2*node],seg2[2*node + 1]);
				seg3[node] = max(seg3[2*node],seg3[2*node + 1]);

	}
}

inline void lazy(int node, int s, int e){
	seg1[node] = lzy[node] * (e - s +1);
	seg2[node] = lzy[node];
	seg3[node] = lzy[node];
	if(s != e){
		lzy[2*node] = lzy[node];
		lzy[2*node + 1] = lzy[node];
	}
	lzy[node] = 0;
}

inline void update(int node, int s, int e, int l, int r, int k){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return;
	if(s >= l and e <= r){
		seg1[node] = k *  (e - s +1);
		seg2[node] = k;
		seg2[node] = k;
		if(s != e){
			lzy[2*node] = k;
			lzy[2*node + 1] = k;
		}
		return;
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	update(p, s, mid, l, r, k);
	update(q, mid+1, e, l, r, k);
	seg1[node] = seg1[p] + seg1[q];
	seg2[node] = max(seg2[p],seg2[q]);
	seg3[node] = max(seg3[p],seg3[q]);
}

inline int querymax(int node, int s, int e, int l, int r){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return 0;
	if(s >= l and e <= r){
		return seg2[node];
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	return max(querymax(p, s, mid, l, r),querymax(q, mid + 1, e, l, r));
}

inline int down(int node,int s,int e,int v)
{
	if(s==e)
		return s;
	int mid = (s+e)>>1,p=node<<1,q=p|1;
	if(seg3[2*node]<v)
		return down(2*node,s,mid,v);
	else
		return down(2*node+1,mid+1,e,v);
}

inline int querymin(int node, int s, int e, int l, int r,int v){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return inf;
	if(s >= l and e <= r){
		if(seg3[node] < v){
			return down(node, s, e, v);
		}
		return -1;
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	int a=querymin(p, s, mid, l, r,v),b=querymin(q, mid + 1, e, l, r,v);
	if(a!=-1)
		return a;
	else
		return b;
}

inline int querysum(int node, int s, int e, int l, int r){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return 0;
	if(s >= l and e <= r){
		return seg1[node];
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	return querysum(p, s, mid, l, r) + querysum(q, mid + 1, e, l, r);
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
   	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output1.txt","w",stdout);
	#endif
	int n, k, mn = inf;
	cin >> n >> k;
	for (int i = 1; i <= n; ++i)
	{
		cin >> arr[i];
		mn = min(arr[i], mn);
	}
	sort(arr + 1, arr + n + 1, greater <int>());
	build(1, 1, n);
	int ans = 0;
	while(1){
		int lo = mn, hi = querymax(1, 1, n, 1, n), ind = -1, ind_;
		if(lo == hi){
			break;
		}
		while(lo <= hi){
			int mid = (lo + hi) >> 1;
			int ind2 = querymin(1,1,n,1,n,mid);
			if(ind2==-1)
				ind2=n;
			else
				ind2--;
	//		cout << ind2 << " "<< mid << " "<<querysum(1, 1, n, 1, ind2) - mid*ind2<<"\n";
			if(querysum(1, 1, n, 1, ind2) - mid*ind2 <= k){
				ind = mid;
				hi = mid - 1;
				ind_ = ind2;
			}
			else{
				lo = mid + 1;
			}
		}
	//	cout << ind << " " << ind_ << "*\n";
		//if(ans >0)return 0;
		ans++;
		update(1, 1, n, 1, ind_, ind);
	}
	cout << ans << "\n";
	return 0;
}


#include<bits/stdc++.h>

#define int long long
#define pii pair<int,int>
#define fr first
#define se second
#define ll long long
#define mp make_pair
const int mod=998244353;
const int inf=(int)1e18;

using namespace std;

const int N = 2e5 + 5;
int seg1[4*N], seg2[4*N], seg3[4*N] ,lzy[4*N], arr[N];

inline void build(int node, int s, int e){
	if(s == e){
		seg1[node] = seg2[node] =seg3[node]= arr[s];
	}
	else{
		int mid = (s + e) >> 1;
		build(2*node, s , mid);
		build(2*node + 1, mid + 1, e);
		seg1[node] = seg1[2*node + 1] + seg1[2*node];
		seg2[node] = max(seg2[2*node],seg2[2*node + 1]);
				seg3[node] = max(seg3[2*node],seg3[2*node + 1]);

	}
}

inline void lazy(int node, int s, int e){
	seg1[node] = lzy[node] * (e - s +1);
	seg2[node] = lzy[node];
	seg3[node] = lzy[node];
	if(s != e){
		lzy[2*node] = lzy[node];
		lzy[2*node + 1] = lzy[node];
	}
	lzy[node] = 0;
}

inline void update(int node, int s, int e, int l, int r, int k){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return;
	if(s >= l and e <= r){
		seg1[node] = k *  (e - s +1);
		seg2[node] = k;
		seg2[node] = k;
		if(s != e){
			lzy[2*node] = k;
			lzy[2*node + 1] = k;
		}
		return;
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	update(p, s, mid, l, r, k);
	update(q, mid+1, e, l, r, k);
	seg1[node] = seg1[p] + seg1[q];
	seg2[node] = max(seg2[p],seg2[q]);
	seg3[node] = max(seg3[p],seg3[q]);
}

inline int querymax(int node, int s, int e, int l, int r){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return 0;
	if(s >= l and e <= r){
		return seg2[node];
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	return max(querymax(p, s, mid, l, r),querymax(q, mid + 1, e, l, r));
}

inline int down(int node,int s,int e,int v)
{
	if(s==e)
		return s;
	int mid = (s+e)>>1,p=node<<1,q=p|1;
	if(seg3[2*node]<v)
		return down(2*node,s,mid,v);
	else
		return down(2*node+1,mid+1,e,v);
}

inline int querymin(int node, int s, int e, int l, int r,int v){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return -1;
	if(s >= l and e <= r){
		if(seg3[node] < v){
			return down(node, s, e, v);
		}
		return -1;
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	int a=querymin(p, s, mid, l, r,v),b=querymin(q, mid + 1, e, l, r,v);
	if(a!=-1)
		return a;
	else
		return b;
}
int b1[N],b2[N];
void update(int b[],int i,int v){
	for(;i<N;i+=i&-i)
		b[i]+=v;
}
int sum(int b[],int i)
{
	int t=0;
	for(;i;i-=i&-i)
		t+=b[i];
	return t;
}
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
   	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output1.txt","w",stdout);
	#endif
	int n, k, mn = inf,mx=0;
	cin >> n >> k;
	for (int i = 1; i <= n; ++i)
	{
		cin >> arr[i];
		mn = min(arr[i], mn);
		mx=max(mx,arr[i]);
		update(b1,arr[i],arr[i]);
		update(b2,arr[i],1);
	}
	sort(arr+1,arr+n+1,greater<int>());
	int c = 0,p=0;
	for(int i=mx;i>=mn;i--)
	{
		if(i!=mn){
			int ans=sum(b1,mx)-sum(b1,mx-i+1)-p-(mx-i+1)*(sum(b2,mx)-sum(b2,i+1));
			if(ans>k)
			{
				c++;
				p+=sum(b1,mx)-sum(b1,mx-i)-p-(mx-i)*(sum(b2,mx)-sum(b2,mx-i));
			}
		}
		else
		{
			c++;
		}
	}
	cout<<c<<"\n";
	return 0;
}


#include<bits/stdc++.h>

#define int long long
#define pii pair<int,int>
#define fr first
#define se second
#define ll long long
#define mp make_pair
const int mod=998244353;
const int inf=(int)1e18;

using namespace std;

const int N = 2e5 + 5;
int seg1[N], seg2[N], seg3[N] ,lzy[N], arr[N];

inline void build(int node, int s, int e){
	if(s == e){
		seg1[node] = seg2[node] =seg3[node]= arr[s];
	}
	else{
		int mid = (s + e) >> 1;
		build(2*node, s , mid);
		build(2*node + 1, mid + 1, e);
		seg1[node] = seg1[2*node + 1] + seg1[2*node];
		seg2[node] = max(seg2[2*node],seg2[2*node + 1]);
				seg3[node] = max(seg3[2*node],seg3[2*node + 1]);

	}
}

inline void lazy(int node, int s, int e){
	seg1[node] = lzy[node] * (e - s +1);
	seg2[node] = lzy[node];
	seg3[node] = lzy[node];
	if(s != e){
		lzy[2*node] = lzy[node];
		lzy[2*node + 1] = lzy[node];
	}
	lzy[node] = 0;
}

inline void update(int node, int s, int e, int l, int r, int k){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return;
	if(s >= l and e <= r){
		seg1[node] = k *  (e - s +1);
		seg2[node] = k;
		seg2[node] = k;
		if(s != e){
			lzy[2*node] = k;
			lzy[2*node + 1] = k;
		}
		return;
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	update(p, s, mid, l, r, k);
	update(q, mid+1, e, l, r, k);
	seg1[node] = seg1[p] + seg1[q];
	seg2[node] = max(seg2[p],seg2[q]);
	seg3[node] = max(seg3[p],seg3[q]);
}

inline int querymax(int node, int s, int e, int l, int r){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return 0;
	if(s >= l and e <= r){
		return seg2[node];
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	return max(querymax(p, s, mid, l, r),querymax(q, mid + 1, e, l, r));
}

inline int querymin(int node, int s, int e, int l, int r){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return inf;
	if(s >= l and e <= r){
		return seg3[node];
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	return min(querymin(p, s, mid, l, r),querymin(q, mid + 1, e, l, r));
}

inline int querysum(int node, int s, int e, int l, int r){
	if(lzy[node])
		lazy(node, s, e);
	if(s > r || e < l)
		return 0;
	if(s >= l and e <= r){
		return seg1[node];
	}
	int mid = (s + e) >> 1, p = node << 1, q = p | 1;
	return querysum(p, s, mid, l, r) + querysum(q, mid + 1, e, l, r);
}

inline int bs(int k, int n){
	int lo = 1, hi = n, ans = 0;
	while(lo <= hi){
		int mid = (lo + hi) >> 1;
		if(querymin(1, 1, n, 1, mid) >= k){
			ans = mid;
			lo = mid + 1;
		}
		else{
			hi = mid - 1;
		}
	}
	return ans;
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
   	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output1.txt","w",stdout);
	#endif
	int n, k, mn = inf;
	cin >> n >> k;
	for (int i = 1; i <= n; ++i)
	{
		cin >> arr[i];
		mn = min(arr[i], mn);
	}
	sort(arr + 1, arr + n + 1, greater <int>());
	build(1, 1, n);
	int ans = 0;
	while(1){
		int lo = mn, hi = querymax(1, 1, n, 1, n), ind = -1, ind_;
		if(lo == hi){
			break;
		}
		while(lo <= hi){
			int mid = (lo + hi) >> 1;
			int ind2 = bs(mid, n);
	//		cout << ind2 << " "<< mid << " "<<querysum(1, 1, n, 1, ind2) - mid*ind2<<"\n";
			if(querysum(1, 1, n, 1, ind2) - mid*ind2 <= k){
				ind = mid;
				hi = mid - 1;
				ind_ = ind2;
			}
			else{
				lo = mid + 1;
			}
		}
	//	cout << ind << " " << ind_ << "*\n";
		//if(ans >0)return 0;
		ans++;
		update(1, 1, n, 1, ind_, ind);
	}
	cout << ans << "\n";
	return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000000

#define prime 998244353

const ll N = 300005;

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";
using namespace std;

int n, k;
int v[200100], d[200100], q[200100];

int main(){
	scanf("%d %d", &n, &k);

	int mi = oo, ma = 0;
	for (int i = 0; i < n; ++i){
		scanf("%d", &v[i]);
		mi = min(mi, v[i]);
		ma = max(ma, v[i]);
		d[v[i]]++;
	}

	int aux = n;
	for (int i = 1; i < 200001; ++i){
		q[i]+=aux;
		aux-=d[i];
	}

	ll ans = 0;
	for (int i = ma; i >= mi; ){
		ll sum = 0;
		do{
			sum+=q[i];
			i--;
		}while(i >= mi && sum < k);
		ans++;
	}

	printf("%lld\n", ans);

    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000000

#define prime 998244353

const ll N = 300005;

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";
using namespace std;

int n, k;
int v[200100], d[200100], q[200100];

int main(){
	scanf("%d %d", &n, &k);

	int mi = oo, ma = 0;
	for (int i = 0; i < n; ++i){
		scanf("%d", &v[i]);
		mi = min(mi, v[i]);
		ma = max(ma, v[i]);
		d[v[i]]++;
	}

	int aux = n;
	for (int i = 1; i < 200001; ++i){
		q[i]+=aux;
		aux-=d[i];
	}

	ll ans = 0;
	for (int i = ma; i >= mi; ){
		int sum = 0;
		do{
			sum+=q[i];
			i--;
		}while(i >= mi && sum < k);
		ans++;
	}

	printf("%lld\n", ans);

    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000000

#define prime 998244353

const ll N = 300005;

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";
using namespace std;

int n, k;
int v[200100], d[200100], q[200100];

int main(){
	scanf("%d %d", &n, &k);

	int mi = oo, ma = 0;
	for (int i = 0; i < n; ++i){
		scanf("%d", &v[i]);
		mi = min(mi, v[i]);
		ma = max(ma, v[i]);
		d[v[i]]++;
	}

	int aux = n;
	for (int i = 1; i < 200001; ++i){
		q[i]+=aux;
		aux-=d[i];
	}

	ll ans = 0;
	for (int i = 200001; i >= mi; --i){
		int sum = 0, f = 0;
		do{
			f = 1;
			sum+=q[i];
			i--;
		}while(i >= mi && sum <= k);
		if(f) i++;
		ans++;
	}

	printf("%lld\n", ans);

    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000000

#define prime 998244353

const ll N = 300005;

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";
using namespace std;

int n, k;
int v[200100], d[200100], q[200100];

int main(){
	scanf("%d %d", &n, &k);

	int mi = oo, ma = 0;
	for (int i = 0; i < n; ++i){
		scanf("%d", &v[i]);
		mi = min(mi, v[i]);
		ma = max(ma, v[i]);
		d[v[i]]++;
	}

	int aux = n;
	for (int i = 0; i < 200001; ++i){
		q[i]+=aux;
		aux-=d[i];
	}

	ll ans = 0;
	for (int i = 200001; i >= 0; --i){
		int sum = 0;
		do{
			sum+=q[i];
			i--;
		}while(i>=0 && sum < k);
		ans++;
	}

	printf("%lld\n", ans);

    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000000

#define prime 998244353

const ll N = 300005;

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";
using namespace std;

int n, k;
int v[200100], d[200100], q[200100];

int main(){
	scanf("%d %d", &n, &k);

	int mi = oo, ma = 0;
	for (int i = 0; i < n; ++i){
		scanf("%d", &v[i]);
		mi = min(mi, v[i]);
		ma = max(ma, v[i]);
		d[v[i]]++;
	}

	int aux = n;
	for (int i = 0; i < 200001; ++i){
		q[i]+=aux;
		aux-=d[i];
	}

	ll ans = 0;
	for (int i = ma; i >= 0; --i){
		int sum = 0;
		do{
			sum+=q[i];
			i--;
		}while(i>=0 && sum < k);
		ans++;
	}

	printf("%lld\n", ans);

    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000000

#define prime 998244353

const ll N = 300005;

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";
using namespace std;

int n, k;
int v[200100], d[200100], q[200100];

int main(){
	scanf("%d %d", &n, &k);

	int mi = oo, ma = 0;
	for (int i = 0; i < n; ++i){
		scanf("%d", &v[i]);
		mi = min(mi, v[i]);
		ma = max(ma, v[i]);
		d[v[i]]++;
	}

	int aux = n;
	for (int i = 1; i < 200001; ++i){
		q[i]+=aux;
		aux-=d[i];
	}

	ll ans = 0;
	for (int i = ma+1; i > mi; ){
		ll sum = 0;
		do{
			i--;
			sum+=q[i];
		}while(i > mi && sum < k);
		ans++;
	}

	printf("%lld\n", ans);

    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000000000000000

#define prime 998244353

const ll N = 300005;

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";
using namespace std;

int n, k;
int v[200100];
ll p[200100];

int main(){
	scanf("%d %d", &n, &k);

	ll mi = oo;
	for (int i = 0; i < n; ++i){
		scanf("%d", &v[i]);
		mi = min(mi, (ll)v[i]);
	}

	ll sum = 0;
	for (int i = 0; i < n; ++i){
		sum+=v[i]-mi;
	}

	printf("%lld\n", (sum+n-1)/n);

    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000000

#define prime 998244353

const ll N = 300005;

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";
using namespace std;

int n, k;
int v[200100], d[200100], q[200100];

int main(){
	scanf("%d %d", &n, &k);

	int mi = oo, ma = 0;
	for (int i = 0; i < n; ++i){
		scanf("%d", &v[i]);
		mi = min(mi, v[i]);
		ma = max(ma, v[i]);
		d[v[i]]++;
	}

	int aux = n;
	for (int i = 1; i < 200001; ++i){
		q[i]=aux;
		aux-=d[i];
	}

	ll ans = 0;
	for (int i = ma+1; i > mi; ){
		ll sum = 0;
		do{
			i--;
			if(i == mi) break;
			if(sum+q[i] > k){
				i++;
				break;
			}
			else sum+=q[i];
		}while(i > mi);
		ans++;
	}

	printf("%lld\n", ans);

    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000000

#define prime 998244353

const ll N = 300005;

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";
using namespace std;

int n, k;
int v[200100], d[200100], q[200100];

int main(){
	scanf("%d %d", &n, &k);

	int mi = oo, ma = 0;
	for (int i = 0; i < n; ++i){
		scanf("%d", &v[i]);
		mi = min(mi, v[i]);
		ma = max(ma, v[i]);
		d[v[i]]++;
	}

	int aux = n, awayout = 0;
	for (int i = 1; i < 200001; ++i){
		if(d[i]) awayout++;
		q[i]=aux;
		aux-=d[i];
	}

	if(awayout == 1){
		printf("0\n");
		return 0;
	}

	ll ans = 0;
	for (int i = ma+1; i > mi; ){
		ll sum = 0;
		do{
			i--;
			if(i == mi) break;
			if(sum+q[i] > k){
				i++;
				break;
			}
			else sum+=q[i];
		}while(i > mi);
		ans++;
	}

	printf("%lld\n", ans);

    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000000

#define prime 998244353

const ll N = 300005;

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";
using namespace std;

int n, k;
int v[200100], d[200100], q[200100];

int main(){
	scanf("%d %d", &n, &k);

	int mi = oo, ma = 0;
	for (int i = 0; i < n; ++i){
		scanf("%d", &v[i]);
		mi = min(mi, v[i]);
		ma = max(ma, v[i]);
		d[v[i]]++;
	}

	int aux = n;
	for (int i = 0; i < 200001; ++i){
		q[i]+=aux;
		aux-=d[i];
	}

	ll ans = 0;
	for (int i = 200001; i > mi; --i){
		int sum = 0;
		do{
			sum+=q[i];
			i--;
		}while(i>=0 && sum < k);
		ans++;
	}

	printf("%lld\n", ans);

    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000000

#define prime 998244353

const ll N = 300005;

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";
using namespace std;

int n, k;
int v[200100], d[200100], q[200100];

int main(){
	scanf("%d %d", &n, &k);

	int mi = oo, ma = 0;
	for (int i = 0; i < n; ++i){
		scanf("%d", &v[i]);
		mi = min(mi, v[i]);
		ma = max(ma, v[i]);
		d[v[i]]++;
	}

	int aux = n;
	for (int i = 1; i < 200001; ++i){
		q[i]+=aux;
		aux-=d[i];
	}

	ll ans = 0;
	for (int i = 200001; i >= mi; ){
		int sum = 0, f = 0;
		do{
			f = 1;
			sum+=q[i];
			i--;
		}while(i >= mi && sum < k);
		if(!f) i--;
		ans++;
	}

	printf("%lld\n", ans);

    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000000

#define prime 998244353

const ll N = 300005;

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";
using namespace std;

int n, k;
int v[200100], d[200100], q[200100];

int main(){
	scanf("%d %d", &n, &k);

	int mi = oo, ma = 0;
	for (int i = 0; i < n; ++i){
		scanf("%d", &v[i]);
		mi = min(mi, v[i]);
		ma = max(ma, v[i]);
		d[v[i]]++;
	}

	int aux = n;
	for (int i = 1; i < 200001; ++i){
		q[i]+=aux;
		aux-=d[i];
	}

	ll ans = 0;
	for (int i = ma+1; i > mi; ){
		ll sum = 0;
		do{
			i--;
			sum+=q[i];
		}while(i > mi+1 && sum < k);
		ans++;
	}

	printf("%lld\n", ans);

    return 0;
}


///...................................*****.................................................///
///                  Mujahidul Islam ( mujahidulislam2923@gmail.com )                       ///
///                  Department of Ict                                                      ///
///                  Comilla University , Bangladesh.                                       ///
///...................................*****.................................................///

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T> using orderset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define          CIN                    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          ull                    unsigned long long int
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          vi                     vector<int>
#define          vl                     vector<ll>
#define          pb                     push_back
#define          sc                     scanf
#define          pf                     printf
#define          scin(x)                scanf("%d",&(x))
#define          scin2(x,y)             scanf("%d %d",&(x),&(y))
#define          scln(x)                scanf("%lld",&(x))
#define          scln2(x,y)             scanf("%lld %lld",&(x),&(y))
#define          min3(a,b,c)            min(a,min(b,c))
#define          min4(a,b,c,d)          min(d,min(a,min(b,c)))
#define          max3(a,b,c)            max(a,max(b,c))
#define          max4(a,b,c,d)          max(d,max(a,max(b,c)))
#define          ms(a,b)                memset(a,b,sizeof(a))
#define          mp                     make_pair
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          input                  freopen("input.txt","rt", stdin)
#define          output                 freopen("output.txt","wt", stdout)
#define          PI                     3.141592653589793238462643
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          Max(v)                 *max_element(all(v))
#define          Upper(c,x)             (upper_bound(c.begin(),c.end(),x)-c.begin())
#define          Lower(c,x)             (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          Unique(X)              (X).erase(unique(all(X)),(X).end())

///priority_queue<int,vector<int>,greater<int> >pq;
///string str = "abcdefghijklmnopqrstuvwxyz";
///string s2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;

///---------------Order set-------------------
///template<typename T> using orderset =tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
///#include <ext/pb_ds/assoc_container.hpp>
///using namespace __gnu_pbds;
///*os.find_by_order(index) os.order_of_key(value)

///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------
///sort( all( v ) ) ;

vl v, v1, v2 ;
vector < pll > vec1, vec2 ;
map < ll, ll > Mp ;
set < ll > st ;
deque < ll > dq ;
stack < ll > stk ;
multiset < ll > S ;
multiset < ll > :: iterator it ;

int main()
{
    CIN ;
    ll n, k, a , mn = INT_MAX , mx = INT_MIN ;
    cin >> n >> k ;
    for( int i = 0 ; i < n ; i ++ )
    {
        cin >> a ;
        mx = max( mx , a ) ;
        mn = min( mn , a ) ;
        Mp[ a ] ++ ;
    }

    ll sum = 0, cnt = 0 ;
    for( int i = mx ; i > mn ; i -- )
    {
        sum += Mp[i ] ;
        if( sum == k )
        {
            sum = 0 ;
        }
        else if( sum > k )
        {
            cnt ++ ;
            sum = Mp[ i ] ;
        }
        Mp[ i - 1 ] += Mp[ i ] ;
    }

    if( sum > 0 )
    {
        cnt ++ ;
    }
    cout << cnt << endl ;

    return 0 ;
}