#include<bits/stdc++.h>

using namespace std;

#include <ext/rope>
using namespace __gnu_cxx;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define int long long

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef map<string, int> MAPS;
typedef map<char, int> MAPC;
typedef map<int, int> MAPI;
typedef set<int> SETI;
typedef set<string> SETS;
typedef set<char> SETC;
typedef complex<double> POINT;
typedef tree<int, int, less<int>, rb_tree_tag,
		tree_order_statistics_node_update> MAP_T;
typedef trie<string, null_type, trie_string_access_traits<>,
		pat_trie_tag, trie_prefix_search_node_update> TRIE;

#define add push_back
#define rem pop_back
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define SZ(x) int((x).size())
#define F first
#define S second
#define NEW(x, y, z) x y; x::iterator z;

void INPUT(int *a, int size)  { for(int i = 0; i < size; ++i) cin >> a[i]; }
void OUTPUT(int *a, int size) { for(int i = 0; i < size; ++i) cout << a[i] << " "; cout << endl;}

#define REPI(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define REP(i, a, b)  for(int i = a; i <  b; i++)
#define REPN(i, a, b) for(int i = a; i <= b; i++)
#define REPV(i, b, a) for(int i = b; i >= a; i--)

const double EPS = 1e-9;
const double PI = acos(-1.);
const int MOD = 1e9 + 7;
const int MAXN = 500001;
int INF = __INT64_MAX__;
int MAX = -1e16;
int MIN = 1e16;
string YN[] = {"NO", "YES"};

#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))

template<typename T1, typename T2> T2 max(T1 a, T2 b) { T2 res = a > b ? a : b; return res; }
template<typename T1, typename T2> T2 min(T1 a, T2 b) { T2 res = a < b ? a : b; return res; }

int POW (int a, int n)
{
		int res = 1;
		while (n) {
				if (n & 1)
						res *= a;
				a *= a;
				n >>= 1;
		}
		return res;
}

string to_string(int n)
{
		stringstream ss;
		string s;
		ss << n;
		ss >> s;
		return s;
}

string to_binary(int n)
{
		string s;
		while(n) {
				s += (n & 1) + '0';
				n >>= 1;
		}
		reverse(ALL(s));
		return s;
}

int GCD_E(int a, int b, int& x, int& y)
{
		if (!a) {
				x = 0;
				y = 1;
				return b;
		}
		int x1, y1;
		int d = GCD_E(b % a, a, x1, y1);
		x = y1 - (b / a) * x1;
		y = x1;
		return d;
}

inline int addMOD(int a, int b, int m = MOD)
{
		return (a + b) % m;
}

inline int mulMOD(int a, int b, int m = MOD)
{
		return (a * b) % m;
}

inline int divMOD(int a, int b, int m = MOD)
{
		int x, y;
		int g = GCD_E(b, m, x, y);
		x = (x % m + m) % m;
		return mulMOD(a, x, m);
}

int fact[MAXN];
inline int C(int k, int n)
{
		return divMOD(fact[n], mulMOD(fact[n - k], fact[k]));
}

int px[] = { 1, 1, -1, -1 };
int py[] = { -1, 1, -1, 1};
int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
int fx[] = {-2, -2, -1, -1,  1,  1,  2,  2};
int fy[] = {-1,  1, -2,  2, -2,  2, -1,  1};

int n, m, k, cnt, res;
int A[MAXN], B[MAXN];
string s, t;
MAPI mp;

void solution()
{
		cin >> n;
		REPN(i, 1, 2 * n){
			cin >> A[i];
			mp[A[i]]++;
		}

		sort(A + 1, A + 1 + 2 * n);
		int a = A[n] - A[1];
		int b = A[2 * n] - A[n + 1];
		cout << a * b;

}

__INT16_C() main()
{
		//ifstream fin("input.in");
		//ofstream fout("output.out");

		ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

		int t = 1;
		// cin >> t;

		while(t--) solution();
}


#include<bits/stdc++.h>

using namespace std;

#include <ext/rope>
using namespace __gnu_cxx;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define int long long

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef map<string, int> MAPS;
typedef map<char, int> MAPC;
typedef map<int, int> MAPI;
typedef set<int> SETI;
typedef set<string> SETS;
typedef set<char> SETC;
typedef complex<double> POINT;
typedef tree<int, int, less<int>, rb_tree_tag,
		tree_order_statistics_node_update> MAP_T;
typedef trie<string, null_type, trie_string_access_traits<>,
		pat_trie_tag, trie_prefix_search_node_update> TRIE;

#define add push_back
#define rem pop_back
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define SZ(x) int((x).size())
#define F first
#define S second
#define NEW(x, y, z) x y; x::iterator z;

void INPUT(int *a, int size)  { for(int i = 0; i < size; ++i) cin >> a[i]; }
void OUTPUT(int *a, int size) { for(int i = 0; i < size; ++i) cout << a[i] << " "; cout << endl;}

#define REPI(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define REP(i, a, b)  for(int i = a; i <  b; i++)
#define REPN(i, a, b) for(int i = a; i <= b; i++)
#define REPV(i, b, a) for(int i = b; i >= a; i--)

const double EPS = 1e-9;
const double PI = acos(-1.);
const int MOD = 1e9 + 7;
const int MAXN = 500001;
int INF = __INT64_MAX__;
int MAX = -1e16;
int MIN = 1e16;
string YN[] = {"NO", "YES"};

#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))

template<typename T1, typename T2> T2 max(T1 a, T2 b) { T2 res = a > b ? a : b; return res; }
template<typename T1, typename T2> T2 min(T1 a, T2 b) { T2 res = a < b ? a : b; return res; }

int POW (int a, int n)
{
		int res = 1;
		while (n) {
				if (n & 1)
						res *= a;
				a *= a;
				n >>= 1;
		}
		return res;
}

string to_string(int n)
{
		stringstream ss;
		string s;
		ss << n;
		ss >> s;
		return s;
}

string to_binary(int n)
{
		string s;
		while(n) {
				s += (n & 1) + '0';
				n >>= 1;
		}
		reverse(ALL(s));
		return s;
}

int GCD_E(int a, int b, int& x, int& y)
{
		if (!a) {
				x = 0;
				y = 1;
				return b;
		}
		int x1, y1;
		int d = GCD_E(b % a, a, x1, y1);
		x = y1 - (b / a) * x1;
		y = x1;
		return d;
}

inline int addMOD(int a, int b, int m = MOD)
{
		return (a + b) % m;
}

inline int mulMOD(int a, int b, int m = MOD)
{
		return (a * b) % m;
}

inline int divMOD(int a, int b, int m = MOD)
{
		int x, y;
		int g = GCD_E(b, m, x, y);
		x = (x % m + m) % m;
		return mulMOD(a, x, m);
}

int fact[MAXN];
inline int C(int k, int n)
{
		return divMOD(fact[n], mulMOD(fact[n - k], fact[k]));
}

int px[] = { 1, 1, -1, -1 };
int py[] = { -1, 1, -1, 1};
int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
int fx[] = {-2, -2, -1, -1,  1,  1,  2,  2};
int fy[] = {-1,  1, -2,  2, -2,  2, -1,  1};

int n, m, k, cnt, res;
int A[MAXN], B[MAXN];
string s, t;
MAPI mp;

void solution()
{
		cin >> n;
		REPN(i, 1, 2 * n){
			cin >> A[i];
			mp[A[i]]++;
		}
		int temp, tmp;
		sort(A + 1, A + 1 + 2 * n);
		for(auto it = mp.begin(); it != mp.end(); it++){
			cnt += it -> second;
			if(cnt >= n){
				temp = it -> first;
				it++;
				tmp = it -> first;
				break;
			}
		}
		cout << (A[2 * n] - tmp) * (temp - A[1]);

}

__INT16_C() main()
{
		//ifstream fin("input.in");
		//ofstream fout("output.out");

		ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

		int t = 1;
		// cin >> t;

		while(t--) solution();
}


#include<bits/stdc++.h>

using namespace std;

#include <ext/rope>
using namespace __gnu_cxx;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define int long long

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef map<string, int> MAPS;
typedef map<char, int> MAPC;
typedef map<int, int> MAPI;
typedef set<int> SETI;
typedef set<string> SETS;
typedef set<char> SETC;
typedef complex<double> POINT;
typedef tree<int, int, less<int>, rb_tree_tag,
		tree_order_statistics_node_update> MAP_T;
typedef trie<string, null_type, trie_string_access_traits<>,
		pat_trie_tag, trie_prefix_search_node_update> TRIE;

#define add push_back
#define rem pop_back
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define SZ(x) int((x).size())
#define F first
#define S second
#define NEW(x, y, z) x y; x::iterator z;

void INPUT(int *a, int size)  { for(int i = 0; i < size; ++i) cin >> a[i]; }
void OUTPUT(int *a, int size) { for(int i = 0; i < size; ++i) cout << a[i] << " "; cout << endl;}

#define REPI(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define REP(i, a, b)  for(int i = a; i <  b; i++)
#define REPN(i, a, b) for(int i = a; i <= b; i++)
#define REPV(i, b, a) for(int i = b; i >= a; i--)

const double EPS = 1e-9;
const double PI = acos(-1.);
const int MOD = 1e9 + 7;
const int MAXN = 500001;
int INF = __INT64_MAX__;
int MAX = -1e16;
int MIN = 1e16;
string YN[] = {"NO", "YES"};

#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))

template<typename T1, typename T2> T2 max(T1 a, T2 b) { T2 res = a > b ? a : b; return res; }
template<typename T1, typename T2> T2 min(T1 a, T2 b) { T2 res = a < b ? a : b; return res; }

int POW (int a, int n)
{
		int res = 1;
		while (n) {
				if (n & 1)
						res *= a;
				a *= a;
				n >>= 1;
		}
		return res;
}

string to_string(int n)
{
		stringstream ss;
		string s;
		ss << n;
		ss >> s;
		return s;
}

string to_binary(int n)
{
		string s;
		while(n) {
				s += (n & 1) + '0';
				n >>= 1;
		}
		reverse(ALL(s));
		return s;
}

int GCD_E(int a, int b, int& x, int& y)
{
		if (!a) {
				x = 0;
				y = 1;
				return b;
		}
		int x1, y1;
		int d = GCD_E(b % a, a, x1, y1);
		x = y1 - (b / a) * x1;
		y = x1;
		return d;
}

inline int addMOD(int a, int b, int m = MOD)
{
		return (a + b) % m;
}

inline int mulMOD(int a, int b, int m = MOD)
{
		return (a * b) % m;
}

inline int divMOD(int a, int b, int m = MOD)
{
		int x, y;
		int g = GCD_E(b, m, x, y);
		x = (x % m + m) % m;
		return mulMOD(a, x, m);
}

int fact[MAXN];
inline int C(int k, int n)
{
		return divMOD(fact[n], mulMOD(fact[n - k], fact[k]));
}

int px[] = { 1, 1, -1, -1 };
int py[] = { -1, 1, -1, 1};
int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
int fx[] = {-2, -2, -1, -1,  1,  1,  2,  2};
int fy[] = {-1,  1, -2,  2, -2,  2, -1,  1};

int n, m, k, cnt, res;
int A[MAXN], B[MAXN];
string s, t;
MAPI mp;

void solution()
{
		cin >> n;
		REPN(i, 1, 2 * n){
			cin >> A[i];
			mp[A[i]]++;
			if(mp[A[i]] >= n){
				cout << 0;
				return;
			}
		}

		sort(A + 1, A + 1 + 2 * n);
		int a = A[n] - A[1];
		int b = A[2 * n] - A[n + 1];
		cout << a * b;

}

__INT16_C() main()
{
		//ifstream fin("input.in");
		//ofstream fout("output.out");

		ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

		int t = 1;
		// cin >> t;

		while(t--) solution();
}


#include<bits/stdc++.h>

using namespace std;

#include <ext/rope>
using namespace __gnu_cxx;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define int long long

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef map<string, int> MAPS;
typedef map<char, int> MAPC;
typedef map<int, int> MAPI;
typedef set<int> SETI;
typedef set<string> SETS;
typedef set<char> SETC;
typedef complex<double> POINT;
typedef tree<int, int, less<int>, rb_tree_tag,
		tree_order_statistics_node_update> MAP_T;
typedef trie<string, null_type, trie_string_access_traits<>,
		pat_trie_tag, trie_prefix_search_node_update> TRIE;

#define add push_back
#define rem pop_back
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define SZ(x) int((x).size())
#define F first
#define S second
#define NEW(x, y, z) x y; x::iterator z;

void INPUT(int *a, int size)  { for(int i = 0; i < size; ++i) cin >> a[i]; }
void OUTPUT(int *a, int size) { for(int i = 0; i < size; ++i) cout << a[i] << " "; cout << endl;}

#define REPI(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define REP(i, a, b)  for(int i = a; i <  b; i++)
#define REPN(i, a, b) for(int i = a; i <= b; i++)
#define REPV(i, b, a) for(int i = b; i >= a; i--)

const double EPS = 1e-9;
const double PI = acos(-1.);
const int MOD = 1e9 + 7;
const int MAXN = 500001;
int INF = __INT64_MAX__;
int MAX = -1e16;
int MIN = 1e16;
string YN[] = {"NO", "YES"};

#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))

template<typename T1, typename T2> T2 max(T1 a, T2 b) { T2 res = a > b ? a : b; return res; }
template<typename T1, typename T2> T2 min(T1 a, T2 b) { T2 res = a < b ? a : b; return res; }

int POW (int a, int n)
{
		int res = 1;
		while (n) {
				if (n & 1)
						res *= a;
				a *= a;
				n >>= 1;
		}
		return res;
}

string to_string(int n)
{
		stringstream ss;
		string s;
		ss << n;
		ss >> s;
		return s;
}

string to_binary(int n)
{
		string s;
		while(n) {
				s += (n & 1) + '0';
				n >>= 1;
		}
		reverse(ALL(s));
		return s;
}

int GCD_E(int a, int b, int& x, int& y)
{
		if (!a) {
				x = 0;
				y = 1;
				return b;
		}
		int x1, y1;
		int d = GCD_E(b % a, a, x1, y1);
		x = y1 - (b / a) * x1;
		y = x1;
		return d;
}

inline int addMOD(int a, int b, int m = MOD)
{
		return (a + b) % m;
}

inline int mulMOD(int a, int b, int m = MOD)
{
		return (a * b) % m;
}

inline int divMOD(int a, int b, int m = MOD)
{
		int x, y;
		int g = GCD_E(b, m, x, y);
		x = (x % m + m) % m;
		return mulMOD(a, x, m);
}

int fact[MAXN];
inline int C(int k, int n)
{
		return divMOD(fact[n], mulMOD(fact[n - k], fact[k]));
}

int px[] = { 1, 1, -1, -1 };
int py[] = { -1, 1, -1, 1};
int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
int fx[] = {-2, -2, -1, -1,  1,  1,  2,  2};
int fy[] = {-1,  1, -2,  2, -2,  2, -1,  1};

int n, m, k, cnt, res;
int A[MAXN], B[MAXN];
string s, t;
MAPI mp;

void solution()
{
		cin >> n;
		REPN(i, 1, 2 * n){
			cin >> A[i];
		}

		sort(A + 1, A + 1 + 2 * n);
		REP(i, 2, n){
			res = (A[i + n] - A[i]) * (A[2 * n] - A[1]);
			MIN = min(MIN, res);
		}
		int a = A[n] - A[1];
		int b = A[2 * n] - A[n + 1];
		MIN = min(MIN, a * b);
		cout << MIN;

}

__INT16_C() main()
{
		//ifstream fin("input.in");
		//ofstream fout("output.out");

		ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

		int t = 1;
		// cin >> t;

		while(t--) solution();
}


#include<bits/stdc++.h>

using namespace std;

#include <ext/rope>
using namespace __gnu_cxx;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define int long long

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef map<string, int> MAPS;
typedef map<char, int> MAPC;
typedef map<int, int> MAPI;
typedef set<int> SETI;
typedef set<string> SETS;
typedef set<char> SETC;
typedef complex<double> POINT;
typedef tree<int, int, less<int>, rb_tree_tag,
		tree_order_statistics_node_update> MAP_T;
typedef trie<string, null_type, trie_string_access_traits<>,
		pat_trie_tag, trie_prefix_search_node_update> TRIE;

#define add push_back
#define rem pop_back
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define SZ(x) int((x).size())
#define F first
#define S second
#define NEW(x, y, z) x y; x::iterator z;

void INPUT(int *a, int size)  { for(int i = 0; i < size; ++i) cin >> a[i]; }
void OUTPUT(int *a, int size) { for(int i = 0; i < size; ++i) cout << a[i] << " "; cout << endl;}

#define REPI(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define REP(i, a, b)  for(int i = a; i <  b; i++)
#define REPN(i, a, b) for(int i = a; i <= b; i++)
#define REPV(i, b, a) for(int i = b; i >= a; i--)

const double EPS = 1e-9;
const double PI = acos(-1.);
const int MOD = 1e9 + 7;
const int MAXN = 500001;
int INF = __INT64_MAX__;
int MAX = -1e16;
int MIN = 1e16;
string YN[] = {"NO", "YES"};

#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))

template<typename T1, typename T2> T2 max(T1 a, T2 b) { T2 res = a > b ? a : b; return res; }
template<typename T1, typename T2> T2 min(T1 a, T2 b) { T2 res = a < b ? a : b; return res; }

int POW (int a, int n)
{
		int res = 1;
		while (n) {
				if (n & 1)
						res *= a;
				a *= a;
				n >>= 1;
		}
		return res;
}

string to_string(int n)
{
		stringstream ss;
		string s;
		ss << n;
		ss >> s;
		return s;
}

string to_binary(int n)
{
		string s;
		while(n) {
				s += (n & 1) + '0';
				n >>= 1;
		}
		reverse(ALL(s));
		return s;
}

int GCD_E(int a, int b, int& x, int& y)
{
		if (!a) {
				x = 0;
				y = 1;
				return b;
		}
		int x1, y1;
		int d = GCD_E(b % a, a, x1, y1);
		x = y1 - (b / a) * x1;
		y = x1;
		return d;
}

inline int addMOD(int a, int b, int m = MOD)
{
		return (a + b) % m;
}

inline int mulMOD(int a, int b, int m = MOD)
{
		return (a * b) % m;
}

inline int divMOD(int a, int b, int m = MOD)
{
		int x, y;
		int g = GCD_E(b, m, x, y);
		x = (x % m + m) % m;
		return mulMOD(a, x, m);
}

int fact[MAXN];
inline int C(int k, int n)
{
		return divMOD(fact[n], mulMOD(fact[n - k], fact[k]));
}

int px[] = { 1, 1, -1, -1 };
int py[] = { -1, 1, -1, 1};
int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
int fx[] = {-2, -2, -1, -1,  1,  1,  2,  2};
int fy[] = {-1,  1, -2,  2, -2,  2, -1,  1};

int n, m, k, cnt, res;
int A[MAXN], B[MAXN];
string s, t;
MAPI mp;

void solution()
{
		cin >> n;
		REPN(i, 1, 2 * n){
			cin >> A[i];
		}

		sort(A + 1, A + 1 + 2 * n);
		REPN(i, 2, n){
			res = (A[i + n - 1] - A[i]) * (A[2 * n] - A[1]);
			MIN = min(MIN, res);
		}
		int a = A[n] - A[1];
		int b = A[2 * n] - A[n + 1];
		MIN = min(MIN, a * b);
		cout << MIN;

}

__INT16_C() main()
{
		//ifstream fin("input.in");
		//ofstream fout("output.out");

		ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

		int t = 1;
		// cin >> t;

		while(t--) solution();
}


#include<bits/stdc++.h>

using namespace std;

#include <ext/rope>
using namespace __gnu_cxx;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define int long long

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef map<string, int> MAPS;
typedef map<char, int> MAPC;
typedef map<int, int> MAPI;
typedef set<int> SETI;
typedef set<string> SETS;
typedef set<char> SETC;
typedef complex<double> POINT;
typedef tree<int, int, less<int>, rb_tree_tag,
		tree_order_statistics_node_update> MAP_T;
typedef trie<string, null_type, trie_string_access_traits<>,
		pat_trie_tag, trie_prefix_search_node_update> TRIE;

#define add push_back
#define rem pop_back
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define SZ(x) int((x).size())
#define F first
#define S second
#define NEW(x, y, z) x y; x::iterator z;

void INPUT(int *a, int size)  { for(int i = 0; i < size; ++i) cin >> a[i]; }
void OUTPUT(int *a, int size) { for(int i = 0; i < size; ++i) cout << a[i] << " "; cout << endl;}

#define REPI(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define REP(i, a, b)  for(int i = a; i <  b; i++)
#define REPN(i, a, b) for(int i = a; i <= b; i++)
#define REPV(i, b, a) for(int i = b; i >= a; i--)

const double EPS = 1e-9;
const double PI = acos(-1.);
const int MOD = 1e9 + 7;
const int MAXN = 500001;
int INF = __INT64_MAX__;
int MAX = -1e16;
int MIN = 1e16;
string YN[] = {"NO", "YES"};

#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))

template<typename T1, typename T2> T2 max(T1 a, T2 b) { T2 res = a > b ? a : b; return res; }
template<typename T1, typename T2> T2 min(T1 a, T2 b) { T2 res = a < b ? a : b; return res; }

int POW (int a, int n)
{
		int res = 1;
		while (n) {
				if (n & 1)
						res *= a;
				a *= a;
				n >>= 1;
		}
		return res;
}

string to_string(int n)
{
		stringstream ss;
		string s;
		ss << n;
		ss >> s;
		return s;
}

string to_binary(int n)
{
		string s;
		while(n) {
				s += (n & 1) + '0';
				n >>= 1;
		}
		reverse(ALL(s));
		return s;
}

int GCD_E(int a, int b, int& x, int& y)
{
		if (!a) {
				x = 0;
				y = 1;
				return b;
		}
		int x1, y1;
		int d = GCD_E(b % a, a, x1, y1);
		x = y1 - (b / a) * x1;
		y = x1;
		return d;
}

inline int addMOD(int a, int b, int m = MOD)
{
		return (a + b) % m;
}

inline int mulMOD(int a, int b, int m = MOD)
{
		return (a * b) % m;
}

inline int divMOD(int a, int b, int m = MOD)
{
		int x, y;
		int g = GCD_E(b, m, x, y);
		x = (x % m + m) % m;
		return mulMOD(a, x, m);
}

int fact[MAXN];
inline int C(int k, int n)
{
		return divMOD(fact[n], mulMOD(fact[n - k], fact[k]));
}

int px[] = { 1, 1, -1, -1 };
int py[] = { -1, 1, -1, 1};
int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
int fx[] = {-2, -2, -1, -1,  1,  1,  2,  2};
int fy[] = {-1,  1, -2,  2, -2,  2, -1,  1};

int n, m, k, cnt, res;
int A[MAXN], B[MAXN];
string s, t;
MAPI mp;

void solution()
{
		cin >> n;
		REPN(i, 1, 2 * n){
			cin >> A[i];
			mp[A[i]]++;
		}
		int temp, tmp;
		sort(A + 1, A + 1 + 2 * n);
		for(auto it = mp.begin(); it != mp.end(); it++){
			cnt += it -> second;
			if(cnt >= n){
				temp = it -> first;
				it++;
				tmp = it -> first;
				break;
			}
		}
		cout << min((A[2 * n] - temp) * (tmp - A[1]), (A[2 * n] - tmp) * (temp - A[1]));

}

__INT16_C() main()
{
		//ifstream fin("input.in");
		//ofstream fout("output.out");

		ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

		int t = 1;
		// cin >> t;

		while(t--) solution();
}


#include<bits/stdc++.h>

using namespace std;

#include <ext/rope>
using namespace __gnu_cxx;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define int long long

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef map<string, int> MAPS;
typedef map<char, int> MAPC;
typedef map<int, int> MAPI;
typedef set<int> SETI;
typedef set<string> SETS;
typedef set<char> SETC;
typedef complex<double> POINT;
typedef tree<int, int, less<int>, rb_tree_tag,
		tree_order_statistics_node_update> MAP_T;
typedef trie<string, null_type, trie_string_access_traits<>,
		pat_trie_tag, trie_prefix_search_node_update> TRIE;

#define add push_back
#define rem pop_back
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define SZ(x) int((x).size())
#define F first
#define S second
#define NEW(x, y, z) x y; x::iterator z;

void INPUT(int *a, int size)  { for(int i = 0; i < size; ++i) cin >> a[i]; }
void OUTPUT(int *a, int size) { for(int i = 0; i < size; ++i) cout << a[i] << " "; cout << endl;}

#define REPI(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define REP(i, a, b)  for(int i = a; i <  b; i++)
#define REPN(i, a, b) for(int i = a; i <= b; i++)
#define REPV(i, b, a) for(int i = b; i >= a; i--)

const double EPS = 1e-9;
const double PI = acos(-1.);
const int MOD = 1e9 + 7;
const int MAXN = 500001;
int INF = __INT64_MAX__;
int MAX = -1e16;
int MIN = 1e16;
string YN[] = {"NO", "YES"};

#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))

template<typename T1, typename T2> T2 max(T1 a, T2 b) { T2 res = a > b ? a : b; return res; }
template<typename T1, typename T2> T2 min(T1 a, T2 b) { T2 res = a < b ? a : b; return res; }

int POW (int a, int n)
{
		int res = 1;
		while (n) {
				if (n & 1)
						res *= a;
				a *= a;
				n >>= 1;
		}
		return res;
}

string to_string(int n)
{
		stringstream ss;
		string s;
		ss << n;
		ss >> s;
		return s;
}

string to_binary(int n)
{
		string s;
		while(n) {
				s += (n & 1) + '0';
				n >>= 1;
		}
		reverse(ALL(s));
		return s;
}

int GCD_E(int a, int b, int& x, int& y)
{
		if (!a) {
				x = 0;
				y = 1;
				return b;
		}
		int x1, y1;
		int d = GCD_E(b % a, a, x1, y1);
		x = y1 - (b / a) * x1;
		y = x1;
		return d;
}

inline int addMOD(int a, int b, int m = MOD)
{
		return (a + b) % m;
}

inline int mulMOD(int a, int b, int m = MOD)
{
		return (a * b) % m;
}

inline int divMOD(int a, int b, int m = MOD)
{
		int x, y;
		int g = GCD_E(b, m, x, y);
		x = (x % m + m) % m;
		return mulMOD(a, x, m);
}

int fact[MAXN];
inline int C(int k, int n)
{
		return divMOD(fact[n], mulMOD(fact[n - k], fact[k]));
}

int px[] = { 1, 1, -1, -1 };
int py[] = { -1, 1, -1, 1};
int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
int fx[] = {-2, -2, -1, -1,  1,  1,  2,  2};
int fy[] = {-1,  1, -2,  2, -2,  2, -1,  1};

int n, m, k, cnt, res;
int A[MAXN], B[MAXN];
string s, t;
MAPI mp;

void solution()
{
		cin >> n;
		if(n <= 2) while(1);
		REPN(i, 1, 2 * n){
			cin >> A[i];
			mp[A[i]]++;
			if(mp[A[i]] >= n){
				cout << 0;
				return;
			}
		}
		int temp, tmp;
		sort(A + 1, A + 1 + 2 * n);
		for(auto it = mp.begin(); it != mp.end(); it++){
			cnt += it -> second;
			if(cnt >= n){
				temp = it -> first;
				it++;
				tmp = it -> first;
				break;
			}
		}
		cout << (temp - A[1]) * (A[2 * n] - tmp);

}

__INT16_C() main()
{
		//ifstream fin("input.in");
		//ofstream fout("output.out");

		ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

		int t = 1;
		// cin >> t;

		while(t--) solution();
}


#include<bits/stdc++.h>

using namespace std;

#include <ext/rope>
using namespace __gnu_cxx;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define int long long

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef map<string, int> MAPS;
typedef map<char, int> MAPC;
typedef map<int, int> MAPI;
typedef set<int> SETI;
typedef set<string> SETS;
typedef set<char> SETC;
typedef complex<double> POINT;
typedef tree<int, int, less<int>, rb_tree_tag,
		tree_order_statistics_node_update> MAP_T;
typedef trie<string, null_type, trie_string_access_traits<>,
		pat_trie_tag, trie_prefix_search_node_update> TRIE;

#define add push_back
#define rem pop_back
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define SZ(x) int((x).size())
#define F first
#define S second
#define NEW(x, y, z) x y; x::iterator z;

void INPUT(int *a, int size)  { for(int i = 0; i < size; ++i) cin >> a[i]; }
void OUTPUT(int *a, int size) { for(int i = 0; i < size; ++i) cout << a[i] << " "; cout << endl;}

#define REPI(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define REP(i, a, b)  for(int i = a; i <  b; i++)
#define REPN(i, a, b) for(int i = a; i <= b; i++)
#define REPV(i, b, a) for(int i = b; i >= a; i--)

const double EPS = 1e-9;
const double PI = acos(-1.);
const int MOD = 1e9 + 7;
const int MAXN = 500001;
int INF = __INT64_MAX__;
int MAX = -1e16;
int MIN = 1e16;
string YN[] = {"NO", "YES"};

#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))

template<typename T1, typename T2> T2 max(T1 a, T2 b) { T2 res = a > b ? a : b; return res; }
template<typename T1, typename T2> T2 min(T1 a, T2 b) { T2 res = a < b ? a : b; return res; }

int POW (int a, int n)
{
		int res = 1;
		while (n) {
				if (n & 1)
						res *= a;
				a *= a;
				n >>= 1;
		}
		return res;
}

string to_string(int n)
{
		stringstream ss;
		string s;
		ss << n;
		ss >> s;
		return s;
}

string to_binary(int n)
{
		string s;
		while(n) {
				s += (n & 1) + '0';
				n >>= 1;
		}
		reverse(ALL(s));
		return s;
}

int GCD_E(int a, int b, int& x, int& y)
{
		if (!a) {
				x = 0;
				y = 1;
				return b;
		}
		int x1, y1;
		int d = GCD_E(b % a, a, x1, y1);
		x = y1 - (b / a) * x1;
		y = x1;
		return d;
}

inline int addMOD(int a, int b, int m = MOD)
{
		return (a + b) % m;
}

inline int mulMOD(int a, int b, int m = MOD)
{
		return (a * b) % m;
}

inline int divMOD(int a, int b, int m = MOD)
{
		int x, y;
		int g = GCD_E(b, m, x, y);
		x = (x % m + m) % m;
		return mulMOD(a, x, m);
}

int fact[MAXN];
inline int C(int k, int n)
{
		return divMOD(fact[n], mulMOD(fact[n - k], fact[k]));
}

int px[] = { 1, 1, -1, -1 };
int py[] = { -1, 1, -1, 1};
int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
int fx[] = {-2, -2, -1, -1,  1,  1,  2,  2};
int fy[] = {-1,  1, -2,  2, -2,  2, -1,  1};

int n, m, k, cnt, res;
int A[MAXN], B[MAXN];
string s, t;
MAPI mp;

void solution()
{
		cin >> n;
		REPN(i, 1, 2 * n){
			cin >> A[i];
			mp[A[i]]++;
			if(mp[A[i]] >= n){
				cout << 0;
				return;
			}
		}
		int temp, tmp;
		sort(A + 1, A + 1 + 2 * n);
		for(auto it = mp.begin(); it != mp.end(); it++){
			cnt += it -> second;
			if(cnt >= n){
				temp = it -> first;
				it++;
				tmp = it -> first;
				break;
			}
		}
		cout << temp << " " << tmp << endl;
		cout << (temp - A[1]) * (A[2 * n] - tmp);

}

__INT16_C() main()
{
		//ifstream fin("input.in");
		//ofstream fout("output.out");

		ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

		int t = 1;
		// cin >> t;

		while(t--) solution();
}


#include<bits/stdc++.h>
using namespace std;
using std::string;
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define FORR(i,l,r) for(int (i)=l;(i)<(r);++(i))
#define mod 1000000007
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define bitcount __builtin_popcount
#define all(v) v.begin(),v.end()
#define mem(n,m) memset(n,m,sizeof(n))
#define pii pair<int,int>
#define pll pair<long long,long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int>
#define vll vector<long long>
#define mii map<int,int>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define EPSILON 1e-9
#define MAX 100002
#define PI 3.1415926535897932384626433832795028841971693993751
typedef long long  ll;
typedef unsigned long long llu;
typedef long double  ldb;
typedef double  db ;
/*ll power(ll b,ll p)
{
    if(p==0)
        return 1;
    ll ans=1;
    while(p>1)
    {
        if(p%2==0)
        {
            b*=b;
            b%=mod;
            p/=2;
        }
        else
        {
            ans*=b;
            ans%=mod;
            p-=1;
        }
    }
    ans*=b;
    ans%=mod;
    return ans;
}*/
int a[MAX];
int main()
{
   // freopen("in.txt","r",stdin);
    int n;
    scanf("%d",&n);
    FOR(i,2*n)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    ll ans=a[n/2-1]-a[0];
    ans*=a[n-1]-a[n/2];
    printf("%lld",ans);
}


#include<bits/stdc++.h>
using namespace std;
using std::string;
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define FORR(i,l,r) for(int (i)=l;(i)<(r);++(i))
#define mod 1000000007
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define bitcount __builtin_popcount
#define all(v) v.begin(),v.end()
#define mem(n,m) memset(n,m,sizeof(n))
#define pii pair<int,int>
#define pll pair<long long,long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int>
#define vll vector<long long>
#define mii map<int,int>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define EPSILON 1e-9
#define MAX 100002
#define PI 3.1415926535897932384626433832795028841971693993751
typedef long long  ll;
typedef unsigned long long llu;
typedef long double  ldb;
typedef double  db ;

ll a[2*MAX];
int main()
{
   // freopen("in.txt","r",stdin);
    int N;
    scanf("%d",&N);
    int n=2*N;
    FOR(i,n)
    {
        cin>>a[i];
    }
    sort(a,a+n);
   ll ans=a[n/2-1]-a[0];
    ans*=a[n-1]-a[n/2];
    for(int i=1;i<n/2;i++)
    ans=min(ans,(a[i+n/2-1]-a[i])*(a[n-1]-a[0]));
    printf("%lld",ans);
}


#include<bits/stdc++.h>
using namespace std;
using std::string;
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define FORR(i,l,r) for(int (i)=l;(i)<(r);++(i))
#define mod 1000000007
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define bitcount __builtin_popcount
#define all(v) v.begin(),v.end()
#define mem(n,m) memset(n,m,sizeof(n))
#define pii pair<int,int>
#define pll pair<long long,long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int>
#define vll vector<long long>
#define mii map<int,int>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define EPSILON 1e-9
#define MAX 100002
#define PI 3.1415926535897932384626433832795028841971693993751
typedef long long  ll;
typedef unsigned long long llu;
typedef long double  ldb;
typedef double  db ;
/*ll power(ll b,ll p)
{
    if(p==0)
        return 1;
    ll ans=1;
    while(p>1)
    {
        if(p%2==0)
        {
            b*=b;
            b%=mod;
            p/=2;
        }
        else
        {
            ans*=b;
            ans%=mod;
            p-=1;
        }
    }
    ans*=b;
    ans%=mod;
    return ans;
}*/
ll a[MAX];
mii m;
int main()
{
   // freopen("in.txt","r",stdin);
    int N;
    scanf("%d",&N);
    int n=2*N;
    FOR(i,n)
    {
        cin>>a[i];
        m[a[i]]++;
    }
    sort(a,a+n);
   ll ans=a[n/2-1]-a[0];
    ans*=a[n-1]-a[n/2];
    for(int i=1;i<n/2;i++)
    ans=min(ans,(a[i+n/2-1]-a[i])*(a[n-1]-a[0]));
    printf("%lld",ans);
}


#include<bits/stdc++.h>
using namespace std;
using std::string;
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define FORR(i,l,r) for(int (i)=l;(i)<(r);++(i))
#define mod 1000000007
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define bitcount __builtin_popcount
#define all(v) v.begin(),v.end()
#define mem(n,m) memset(n,m,sizeof(n))
#define pii pair<int,int>
#define pll pair<long long,long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int>
#define vll vector<long long>
#define mii map<int,int>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define EPSILON 1e-9
#define MAX 100002
#define PI 3.1415926535897932384626433832795028841971693993751
typedef long long  ll;
typedef unsigned long long llu;
typedef long double  ldb;
typedef double  db ;
/*ll power(ll b,ll p)
{
    if(p==0)
        return 1;
    ll ans=1;
    while(p>1)
    {
        if(p%2==0)
        {
            b*=b;
            b%=mod;
            p/=2;
        }
        else
        {
            ans*=b;
            ans%=mod;
            p-=1;
        }
    }
    ans*=b;
    ans%=mod;
    return ans;
}*/
ll a[MAX];
mii m;
int main()
{
   // freopen("in.txt","r",stdin);
    int N;ll ans=0;
    scanf("%d",&N);
    int n=2*N;
    FOR(i,n)
    {
        cin>>a[i];
        m[a[i]]++;
    }
    sort(a,a+n);
    if(n>1){
        ll s1=a[0];
        ll s2=a[n/2-1];
        ll m1=a[n-1];
        auto it=m.end();
        it--;it--;
        ll m2=it->first;
      //  cout<<m1<<" "<<m2<<" "<<s1<<" "<<s2<<endl;
        ans=min((m1-a[n/2])*(s2-s1),(m1-s1)*(m2-s2));
    }
    FOR(i,n)
    if(m[a[i]]>=n/2)
        ans=0;
    printf("%lld",ans);
}


#include<bits/stdc++.h>
using namespace std;
using std::string;
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define FORR(i,l,r) for(int (i)=l;(i)<(r);++(i))
#define mod 1000000007
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define bitcount __builtin_popcount
#define all(v) v.begin(),v.end()
#define mem(n,m) memset(n,m,sizeof(n))
#define pii pair<int,int>
#define pll pair<long long,long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int>
#define vll vector<long long>
#define mii map<int,int>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define EPSILON 1e-9
#define MAX 100002
#define PI 3.1415926535897932384626433832795028841971693993751
typedef long long  ll;
typedef unsigned long long llu;
typedef long double  ldb;
typedef double  db ;
/*ll power(ll b,ll p)
{
    if(p==0)
        return 1;
    ll ans=1;
    while(p>1)
    {
        if(p%2==0)
        {
            b*=b;
            b%=mod;
            p/=2;
        }
        else
        {
            ans*=b;
            ans%=mod;
            p-=1;
        }
    }
    ans*=b;
    ans%=mod;
    return ans;
}*/
ll a[MAX];
int main()
{
   // freopen("in.txt","r",stdin);
    int n;
    scanf("%d",&n);
    FOR(i,2*n)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    ll ans=a[n/2-1]-a[0];
    ans*=a[n-1]-a[n/2];
    printf("%lld",ans);
}


#include<bits/stdc++.h>
using namespace std;
using std::string;
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define FORR(i,l,r) for(int (i)=l;(i)<(r);++(i))
#define mod 1000000007
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define bitcount __builtin_popcount
#define all(v) v.begin(),v.end()
#define mem(n,m) memset(n,m,sizeof(n))
#define pii pair<int,int>
#define pll pair<long long,long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int>
#define vll vector<long long>
#define mii map<int,int>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define EPSILON 1e-9
#define MAX 100002
#define PI 3.1415926535897932384626433832795028841971693993751
typedef long long  ll;
typedef unsigned long long llu;
typedef long double  ldb;
typedef double  db ;
/*ll power(ll b,ll p)
{
    if(p==0)
        return 1;
    ll ans=1;
    while(p>1)
    {
        if(p%2==0)
        {
            b*=b;
            b%=mod;
            p/=2;
        }
        else
        {
            ans*=b;
            ans%=mod;
            p-=1;
        }
    }
    ans*=b;
    ans%=mod;
    return ans;
}*/
ll a[MAX];
int main()
{
   // freopen("in.txt","r",stdin);
    int N;
    scanf("%d",&N);
    int n=2*N;
    FOR(i,n)
    {
        cin>>a[i];
    }
    sort(a,a+n);
   ll ans=a[n/2-1]-a[0];
    ans*=a[n-1]-a[n/2];
    for(int i=1;i<n/2;i++)
    ans=min(ans,(a[i+n/2-1]-a[i])*(a[n-1]-a[0]));
    printf("%lld",ans);
}


#include<bits/stdc++.h>
using namespace std;
using std::string;
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define FORR(i,l,r) for(int (i)=l;(i)<(r);++(i))
#define mod 1000000007
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define bitcount __builtin_popcount
#define all(v) v.begin(),v.end()
#define mem(n,m) memset(n,m,sizeof(n))
#define pii pair<int,int>
#define pll pair<long long,long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int>
#define vll vector<long long>
#define mii map<int,int>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define EPSILON 1e-9
#define MAX 100002
#define PI 3.1415926535897932384626433832795028841971693993751
typedef long long  ll;
typedef unsigned long long llu;
typedef long double  ldb;
typedef double  db ;
/*ll power(ll b,ll p)
{
    if(p==0)
        return 1;
    ll ans=1;
    while(p>1)
    {
        if(p%2==0)
        {
            b*=b;
            b%=mod;
            p/=2;
        }
        else
        {
            ans*=b;
            ans%=mod;
            p-=1;
        }
    }
    ans*=b;
    ans%=mod;
    return ans;
}*/
ll a[MAX];
mii m;
int main()
{
   // freopen("in.txt","r",stdin);
    int N;
    scanf("%d",&N);
    int n=2*N;
    FOR(i,n)
    {
        cin>>a[i];
        m[a[i]]++;
    }
    sort(a,a+n);
    ll ans=a[n/2-1]-a[0];
    ans*=a[n-1]-a[n/2];
    FOR(i,n)
    if(m[a[i]]>=n/2)
        ans=0;
    printf("%lld",ans);
}


#include<bits/stdc++.h>
using namespace std;
using std::string;
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define FORR(i,l,r) for(int (i)=l;(i)<(r);++(i))
#define mod 1000000007
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define bitcount __builtin_popcount
#define all(v) v.begin(),v.end()
#define mem(n,m) memset(n,m,sizeof(n))
#define pii pair<int,int>
#define pll pair<long long,long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int>
#define vll vector<long long>
#define mii map<int,int>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define EPSILON 1e-9
#define MAX 100002
#define PI 3.1415926535897932384626433832795028841971693993751
typedef long long  ll;
typedef unsigned long long llu;
typedef long double  ldb;
typedef double  db ;
/*ll power(ll b,ll p)
{
    if(p==0)
        return 1;
    ll ans=1;
    while(p>1)
    {
        if(p%2==0)
        {
            b*=b;
            b%=mod;
            p/=2;
        }
        else
        {
            ans*=b;
            ans%=mod;
            p-=1;
        }
    }
    ans*=b;
    ans%=mod;
    return ans;
}*/
ll a[MAX];
int main()
{
   // freopen("in.txt","r",stdin);
    int N;
    scanf("%d",&N);
    int n=2*N;
    FOR(i,n)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    ll ans=a[n/2-1]-a[0];
    ans*=a[n-1]-a[n/2];
    printf("%lld",ans);
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100005 + 100005;

long long okay[N];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for(int i = 1; i <= n + n; i++) {
    cin >> okay[i];
  }
  sort(okay, okay + n + n + 1);
  long long x1 = okay[1];
  long long x2 = okay[n];
  long long y1 = okay[n + 1];
  long long y2 = okay[n + n];
  //cout << x1 << " " << x2 << " " << y1 << " " << y2;
  long long ans = (x2 - x1) * (y2 - y1);
  /*
  ans = min(ans, (y1 - x1) * (y2 - x2));
  ans = min(ans, (y2 - x1) * (y1 - x2));
  ans = min(ans, (y1 - x2) * (y2 - x1));
  ans = min(ans, (y2 - x2) * (y1 - x1));
  */
  cout << ans << "\n";
  return 0;
}


#include <stdio.h>

int main(void) {
	// your code goes here
	long n,i,c1=0,c2=0,max=0;
	long long min=10000000000;
	scanf("%ld", &n);
	long a[n];
	for(i=0;i<n;i++)
	{scanf("%ld", &a[i]);
	if(a[i]>max)
	max=a[i];
	if(a[i]<min)
	min=a[i];}
	for(i=0;i<n;i++)
	{
		if(min==a[i])
		  c1++;
		  if(max==a[i])
		  c2++;
	}

	printf("%ld %lld",max-min,c1*c2);

	return 0;
}


#include <stdio.h>
void quicksort(long a[],long low,long high);

long partion(long a[],long low,long high);

int main(void) {
	// your code goes here
	long n,i,c1=0,c2=0;
	scanf("%ld", &n);
	long a[n];
	for(i=0;i<n;i++)
	scanf("%ld", &a[i]);

	quicksort(a,0,n-1);
	printf("%ld ", a[n-1]-a[0]);

	for(i=0;i<n;i++)
	{
		if(a[0]==a[i])
		  c1++;
		  if(a[0]!=a[i])
		  break;
	}
	for(i=n-1;i>=0;i--)
	{
		if(a[n-1]==a[i])
		  c2++;
		  if(a[n-1]!=a[i])
		  break;
	}
	printf("%ld", c1*c2);

	return 0;
}
void quicksort(long a[],long low,long high)
{
    if(low<high)
    {
        long pi=partion(a,low,high);
        quicksort(a,low,pi-1);
        quicksort(a,pi+1,high);
    }
}
long partion(long a[],long low,long high)
{
    long i=low-1,j;
    long pi=a[high],t;
    for(j=low;j<high;j++)
    {
        if(a[j]<pi)
        {
            i++;
            t=a[i];
            a[i]=a[j];
            a[j]=t;
        }
    }
    t=a[i+1];
            a[i+1]=a[high];
            a[high]=t;
            return i+1;
}


 #include <stdio.h>

int main(void) {
	// your code goes here
	long long n,i,c1=0,c2=0,max=0;
	long long min;
	scanf("%lld", &n);
	long long a[n];
	for(i=0;i<n;i++)
	{scanf("%lld", &a[i]);
	 if(i==0)
	 min=a[i];
	if(a[i]>max)
	max=a[i];
	if(a[i]<min)
	min=a[i];}
	for(i=0;i<n;i++)
	{
		if(min==a[i])
		  c1++;
		  if(max==a[i])
		  c2++;
	}
	if(max==min)
	printf("0 %lld",(n*(n-1))/2);
	else
	printf("%lld %lld",max-min,c1*c2);

	return 0;
}


#include <stdio.h>

int main(void) {
	// your code goes here
	long n,i,c1=0,c2=0,max=0;
	long min;
	scanf("%ld", &n);
	long a[n];
	for(i=0;i<n;i++)
	{scanf("%ld", &a[i]);
	 if(i==0)
	 min=a[i];
	if(a[i]>max)
	max=a[i];
	if(a[i]<min)
	min=a[i];}
	for(i=0;i<n;i++)
	{
		if(min==a[i])
		  c1++;
		  if(max==a[i])
		  c2++;
	}
	if(max==min)
	printf("0 %ld",(n*(n-1))/2);
	else
	printf("%ld %ld",max-min,c1*c2);

	return 0;
}


#include <stdio.h>
int
main ()
{
  long long int n, i = 0, c = 1, d = 1;
  long long int a[200000], b[200000];
  scanf ("%lld\n", &n);
  for (i = 0; i < n; i++)
    {
      scanf ("%lld ", &a[i]);
    }

  void merging (long long int low, long long int mid, long long int high)
  {
    long long int l1, l2, i;

    for (l1 = low, l2 = mid + 1, i = low; l1 <= mid && l2 <= high; i++)
      {
	if (a[l1] <= a[l2])
	  b[i] = a[l1++];
	else
	  b[i] = a[l2++];
      }

    while (l1 <= mid)
      b[i++] = a[l1++];

    while (l2 <= high)
      b[i++] = a[l2++];

    for (i = low; i <= high; i++)
      a[i] = b[i];
  }

  void sort (long long int low, long long int high)
  {
    long long int mid;

    if (low < high)
      {
	mid = (low + high) / 2;
	sort (low, mid);
	sort (mid + 1, high);
	merging (low, mid, high);
      }
    else
      {
	return;
      }
  }

  sort (0, n - 1);

  printf ("%lld ", a[n - 1] - a[0]);
  if(a[n-1]==a[0]){
      printf("%lld",(n*(n-1)/2));
  }
  else{
      i = 1;
  while (a[i] == a[0])
    {
      c++;

      i++;
    }
  i = 1;
  while (a[n - i - 1] == a[n - 1])
    {
      d++;

      i++;
    }
  printf ("%lld ",c * d);
  }

  return 0;
}


#include <stdio.h>
int
main ()
{
  long long int n, i = 0, c = 1, d = 1;
  long long int a[200000], b[200000];
  scanf ("%lld\n", &n);
  for (i = 0; i < n; i++)
    {
      scanf ("%lld ", &a[i]);
    }

  void merging (long long int low, long long int mid, long long int high)
  {
    long long int l1, l2, i;

    for (l1 = low, l2 = mid + 1, i = low; l1 <= mid && l2 <= high; i++)
      {
	if (a[l1] <= a[l2])
	  b[i] = a[l1++];
	else
	  b[i] = a[l2++];
      }

    while (l1 <= mid)
      b[i++] = a[l1++];

    while (l2 <= high)
      b[i++] = a[l2++];

    for (i = low; i <= high; i++)
      a[i] = b[i];
  }

  void sort (long long int low, long long int high)
  {
    long long int mid;

    if (low < high)
      {
	mid = (low + high) / 2;
	sort (low, mid);
	sort (mid + 1, high);
	merging (low, mid, high);
      }
    else
      {
	return;
      }
  }

  sort (0, n - 1);

  printf ("%lld ", a[n - 1] - a[0]);
  i = 1;
  while (a[i] == a[0])
    {
      c++;

      i++;
    }
  i = 1;
  while (a[n - i - 1] == a[n - 1])
    {
      d++;

      i--;
    }
  printf ("%lld ",c * d);

  return 0;
}


#include <stdio.h>
int
main ()
{
  long long int n, i = 0, c = 1, d = 1;
  long long int a[200000], b[200000];
  scanf ("%lld\n", &n);
  for (i = 0; i < n; i++)
    {
      scanf ("%lld ", &a[i]);
    }

  void merging (long long int low, long long int mid, long long int high)
  {
    long long int l1, l2, i;

    for (l1 = low, l2 = mid + 1, i = low; l1 <= mid && l2 <= high; i++)
      {
	if (a[l1] <= a[l2])
	  b[i] = a[l1++];
	else
	  b[i] = a[l2++];
      }

    while (l1 <= mid)
      b[i++] = a[l1++];

    while (l2 <= high)
      b[i++] = a[l2++];

    for (i = low; i <= high; i++)
      a[i] = b[i];
  }

  void sort (long long int low, long long int high)
  {
    long long int mid;

    if (low < high)
      {
	mid = (low + high) / 2;
	sort (low, mid);
	sort (mid + 1, high);
	merging (low, mid, high);
      }
    else
      {
	return;
      }
  }

  sort (0, n - 1);

  printf ("%lld ", a[n - 1] - a[0]);
  if(a[n-1]==a[0]){
      printf("1");
  }
  else{
      i = 1;
  while (a[i] == a[0])
    {
      c++;

      i++;
    }
  i = 1;
  while (a[n - i - 1] == a[n - 1])
    {
      d++;

      i++;
    }
  printf ("%lld ",c * d);
  }

  return 0;
}


#include <stdio.h>
int
main ()
{
  long long int n, i = 0, c = 1, d = 1;
  long long int a[200000], b[200000];
  scanf ("%lld\n", &n);
  for (i = 0; i < n; i++)
    {
      scanf ("%lld ", &a[i]);
    }

  void merging (long long int low, long long int mid, long long int high)
  {
    long long int l1, l2, i;

    for (l1 = low, l2 = mid + 1, i = low; l1 <= mid && l2 <= high; i++)
      {
	if (a[l1] <= a[l2])
	  b[i] = a[l1++];
	else
	  b[i] = a[l2++];
      }

    while (l1 <= mid)
      b[i++] = a[l1++];

    while (l2 <= high)
      b[i++] = a[l2++];

    for (i = low; i <= high; i++)
      a[i] = b[i];
  }

  void sort (long long int low, long long int high)
  {
    long long int mid;

    if (low < high)
      {
	mid = (low + high) / 2;
	sort (low, mid);
	sort (mid + 1, high);
	merging (low, mid, high);
      }
    else
      {
	return;
      }
  }

  sort (0, n - 1);

  printf ("%lld ", a[n - 1] - a[0]);
  i = 1;
  while (a[i] == a[0])
    {
      c++;

      i++;
    }
  i = 1;
  while (a[n - i - 1] == a[n - 1])
    {
      d++;

      i++;
    }
  printf ("%lld ",c * d);

  return 0;
}


#include <stdio.h>
int
main ()
{
  long long int n, i = 0, c = 1, d = 1;
  long long int a[200000], b[200000];
  scanf ("%lld\n", &n);
  for (i = 0; i < n; i++)
    {
      scanf ("%lld ", &a[i]);
    }

  void merging (long long int low, long long int mid, long long int high)
  {
    long long int l1, l2, i;

    for (l1 = low, l2 = mid + 1, i = low; l1 <= mid && l2 <= high; i++)
      {
	if (a[l1] <= a[l2])
	  b[i] = a[l1++];
	else
	  b[i] = a[l2++];
      }

    while (l1 <= mid)
      b[i++] = a[l1++];

    while (l2 <= high)
      b[i++] = a[l2++];

    for (i = low; i <= high; i++)
      a[i] = b[i];
  }

  void sort (long long int low, long long int high)
  {
    long long int mid;

    if (low < high)
      {
	mid = (low + high) / 2;
	sort (low, mid);
	sort (mid + 1, high);
	merging (low, mid, high);
      }
    else
      {
	return;
      }
  }

  sort (0, n - 1);

  printf ("%lld ", a[n - 1] - a[0]);
  i = 0;
  while (a[i] == a[i + 1])
    {
      c++;

      i++;
    }
  i = 0;
  while (a[n - i - 1] == a[n - i - 2])
    {
      d++;

      i--;
    }
  printf ("%lld ", c * d);

  return 0;
}


#include <stdio.h>
int
main ()
{
  long int n, i = 0, c = 1, d = 1;
  long int a[200000], b[200000];
  scanf ("%ld\n", &n);
  for (i = 0; i < n; i++)
    {
      scanf ("%ld ", &a[i]);
    }

  void merging (long int low, long int mid, long int high)
  {
    long int l1, l2, i;

    for (l1 = low, l2 = mid + 1, i = low; l1 <= mid && l2 <= high; i++)
      {
	if (a[l1] <= a[l2])
	  b[i] = a[l1++];
	else
	  b[i] = a[l2++];
      }

    while (l1 <= mid)
      b[i++] = a[l1++];

    while (l2 <= high)
      b[i++] = a[l2++];

    for (i = low; i <= high; i++)
      a[i] = b[i];
  }

  void sort (long int low, long int high)
  {
    long int mid;

    if (low < high)
      {
	mid = (low + high) / 2;
	sort (low, mid);
	sort (mid + 1, high);
	merging (low, mid, high);
      }
    else
      {
	return;
      }
  }

  sort (0, n - 1);

  printf ("%ld ", a[n - 1] - a[0]);
  i = 0;
  while (a[i] == a[i + 1])
    {
      c++;

      i++;
    }
  i = 0;
  while (a[n - i - 1] == a[n - i - 2])
    {
      d++;

      i--;
    }
  printf ("%ld ", c * d);

  return 0;
}


#include <stdio.h>
#include <limits.h>

#define MAXN 200010
#define INF INT_MAX

#define max(a, b) (a > b) ? (a) : (b)
#define min(a, b) (a < b) ? (a) : (b)

int b[MAXN];

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

    int max_beauty = -INF, min_beauty = INF;
    for (int i = 0; i < n; ++i) {
        scanf("%d", &b[i]);
        max_beauty = max(max_beauty, b[i]);
        min_beauty = min(min_beauty, b[i]);
    }
    int min_cnt = 0, max_cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (b[i] == max_beauty) ++max_cnt;
        if (b[i] == min_beauty) ++min_cnt;
    }

    long long ans = 0;
    if (max_beauty == min_beauty) {
        ans = min_cnt * 1ll * (max_cnt - 1) / 2;
    }
    else {
        ans = min_cnt * max_cnt;
    }

    printf("%d %I64d\n", max_beauty - min_beauty, ans);

    return 0;
}


    #include <iostream>

    using namespace std;

    int main()
    {
        int n;
        long min =__LONG_MAX__;
        long max =0;
        long long max_c=0;
        long long min_c=0;
        cin >> n;
        for(int i=0;i<n;i++)
        {
            long b;
            cin >> b;
            if(b > max)
            {
                max =b;
                max_c =1;
            }
            else
            {
                if(b == max)
                {
                    max_c++;
                }
            }

            if(b < min)
            {
                min =b;
                min_c=1;
            }
            else
            {
                if(b == min)
                {
                    min_c++;
                }
            }
        }
        long dif = max-min;
        long long mult=0;
        if(dif == 0)
            mult = max_c*(max_c-1)/2;
        else
        {
            mult = min_c * max_c;
        }

        cout << dif <<" ";
        cout << mult;
        return 0;
    }


#include <stdio.h>
#include <limits.h>

#define MAXN 200010
#define INF INT_MAX

#define max(a, b) (a > b) ? (a) : (b)
#define min(a, b) (a < b) ? (a) : (b)

int b[MAXN];

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

    int max_beauty = -INF, min_beauty = INF;
    for (int i = 0; i < n; ++i) {
        scanf("%d", &b[i]);
        max_beauty = max(max_beauty, b[i]);
        min_beauty = min(min_beauty, b[i]);
    }
    int min_cnt = 0, max_cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (b[i] == max_beauty) ++max_cnt;
        if (b[i] == min_beauty) ++min_cnt;
    }

    long long ans = 0;
    if (max_beauty == min_beauty) {
        ans = min_cnt * 1ll * (max_cnt - 1) / 2;
    }
    else {
        ans = min_cnt * 1ll * max_cnt;
    }

    printf("%d %I64d\n", max_beauty - min_beauty, ans);

    return 0;
}


#include <stdio.h>////───▄▀▀▀▄▄▄▄▄▄▄▀▀▀▄───
#include <stdlib.h>///───█▒▒░░░░░░░░░▒▒█───
#include <math.h>/////────█░░█░░░░░█░░█────
#include <string.h>///─▄▄──█░░░▀█▀░░░█──▄▄─
#include <ctype.h>////█░░█─▀▄░░░░░░░▄▀─█░░█
#define max(a,b) (a)>(b)?(a):(b)
#define min(a,b) (a)<(b)?(a):(b)
#define inout freopen("in.txt","r",stdin);freopen("out.txt","w",stdout)
#define swap(a,b) a+=b;b=a-b;a-=b
#define quicksort(a,n) qsort(a,n,sizeof(a[0]),cmp)
#define inputarr(a,n)for(int i=0;i<n;i++){scanf("%d",&a[i]);}
#define printarr(a,n) for(int i=0;i<n;i++){printf("%d ",a[i]);}
int cmp(const void *a,const void *b){return *(int *)a - *(int *)b;}

int main(){

	inout;

	int n, m, cnt1 = 1, cnt2 = 1;

	scanf("%d", &n);

	long long int data, min = 1000000009, max = -1;

	for(int i = 0; i < n; i++){
		scanf("%lld", &data);

		if(data == max){cnt1++;}
		if(data == min){cnt2++;}

		if(data > max){max = data;cnt1 = 1;}
		if(data < min){min = data;cnt2 = 1;}
	}

	if(max==min){printf("0 %d", n * (n - 1) / 2);}
    else printf("%lld %d", max - min, cnt1 * cnt2);

}


#include <stdio.h>////───▄▀▀▀▄▄▄▄▄▄▄▀▀▀▄───
#include <stdlib.h>///───█▒▒░░░░░░░░░▒▒█───
#include <math.h>/////────█░░█░░░░░█░░█────
#include <string.h>///─▄▄──█░░░▀█▀░░░█──▄▄─
#include <ctype.h>////█░░█─▀▄░░░░░░░▄▀─█░░█
#define max(a,b) (a)>(b)?(a):(b)
#define min(a,b) (a)<(b)?(a):(b)
#define inout freopen("in.txt","r",stdin);freopen("out.txt","w",stdout)
#define swap(a,b) a+=b;b=a-b;a-=b
#define quicksort(a,n) qsort(a,n,sizeof(a[0]),cmp)
#define inputarr(a,n)for(int i=0;i<n;i++){scanf("%d",&a[i]);}
#define printarr(a,n) for(int i=0;i<n;i++){printf("%d ",a[i]);}
int cmp(const void *a,const void *b){return *(int *)a - *(int *)b;}

int main(){

	//inout;

	int n, m, cnt1 = 1, cnt2 = 1;

	scanf("%d", &n);

	long long int data, min = 9999999999, max = -1;

	for(int i = 0; i < n; i++){
		scanf("%lld", &data);

		if(data == max){cnt1++;}
		if(data == min){cnt2++;}

		if(data > max){max = data;cnt1 = 1;}
		if(data < min){min = data;cnt2 = 1;}
	}

	printf("%lld %d", max - min, cnt1 * cnt2);

}


#include <stdio.h>////───▄▀▀▀▄▄▄▄▄▄▄▀▀▀▄───
#include <stdlib.h>///───█▒▒░░░░░░░░░▒▒█───
#include <math.h>/////────█░░█░░░░░█░░█────
#include <string.h>///─▄▄──█░░░▀█▀░░░█──▄▄─
#include <ctype.h>////█░░█─▀▄░░░░░░░▄▀─█░░█
#define max(a,b) (a)>(b)?(a):(b)
#define min(a,b) (a)<(b)?(a):(b)
#define inout freopen("in.txt","r",stdin);freopen("out.txt","w",stdout)
#define swap(a,b) a+=b;b=a-b;a-=b
#define quicksort(a,n) qsort(a,n,sizeof(a[0]),cmp)
#define inputarr(a,n)for(int i=0;i<n;i++){scanf("%d",&a[i]);}
#define printarr(a,n) for(int i=0;i<n;i++){printf("%d ",a[i]);}
int cmp(const void *a,const void *b){return *(int *)a - *(int *)b;}

long long int n, cnt1 = 0, cnt2 = 0, a[200001], min = 1000000009, max = -1, i;

int main(){

	//inout;

	scanf("%lld", &n);

	for(i = 0; i < n; i++){
		scanf("%lld", &a[i]);
		if(a[i] > max){max = a[i];}
		if(a[i] < min){min = a[i];}
	}

	for(i = 0; i < n; i++){
		if(a[i] == min){cnt1++;}
		if(a[i] == max){cnt2++;}
	}

	if(max==min){printf("0 %lld", n * (n - 1) / 2);}
    else{printf("%lld %lld", max - min, cnt1 * cnt2);}

}


#include <stdio.h>////───▄▀▀▀▄▄▄▄▄▄▄▀▀▀▄───
#include <stdlib.h>///───█▒▒░░░░░░░░░▒▒█───
#include <math.h>/////────█░░█░░░░░█░░█────
#include <string.h>///─▄▄──█░░░▀█▀░░░█──▄▄─
#include <ctype.h>////█░░█─▀▄░░░░░░░▄▀─█░░█
#define max(a,b) (a)>(b)?(a):(b)
#define min(a,b) (a)<(b)?(a):(b)
#define inout freopen("in.txt","r",stdin);freopen("out.txt","w",stdout)
#define swap(a,b) a+=b;b=a-b;a-=b
#define quicksort(a,n) qsort(a,n,sizeof(a[0]),cmp)
#define inputarr(a,n)for(int i=0;i<n;i++){scanf("%d",&a[i]);}
#define printarr(a,n) for(int i=0;i<n;i++){printf("%d ",a[i]);}
int cmp(const void *a,const void *b){return *(int *)a - *(int *)b;}

int main(){

	//inout;

	int n, m, cnt1 = 0, cnt2 = 0;

	scanf("%d", &n);

	long long int a[n], min = 1000000009, max = -1;

	for(int i = 0; i < n; i++){
		scanf("%lld", &a[i]);
		if(a[i] > max){max = a[i];}
		if(a[i] < min){min = a[i];}
	}

	for(int i = 0; i < n; i++){
		if(a[i] == min){cnt1++;}
		if(a[i] == max){cnt2++;}
	}

	if(max==min){printf("0 %d", n * (n - 1) / 2);}
    else printf("%lld %d", max - min, cnt1 * cnt2);

}


#include <stdio.h>////───▄▀▀▀▄▄▄▄▄▄▄▀▀▀▄───
#include <stdlib.h>///───█▒▒░░░░░░░░░▒▒█───
#include <math.h>/////────█░░█░░░░░█░░█────
#include <string.h>///─▄▄──█░░░▀█▀░░░█──▄▄─
#include <ctype.h>////█░░█─▀▄░░░░░░░▄▀─█░░█
#define max(a,b) (a)>(b)?(a):(b)
#define min(a,b) (a)<(b)?(a):(b)
#define inout freopen("in.txt","r",stdin);freopen("out.txt","w",stdout)
#define swap(a,b) a+=b;b=a-b;a-=b
#define quicksort(a,n) qsort(a,n,sizeof(a[0]),cmp)
#define inputarr(a,n)for(int i=0;i<n;i++){scanf("%d",&a[i]);}
#define printarr(a,n) for(int i=0;i<n;i++){printf("%d ",a[i]);}
int cmp(const void *a,const void *b){return *(int *)a - *(int *)b;}

int main(){

	//inout;

	int n, m, cnt1 = 1, cnt2 = 1;

	scanf("%d", &n);

	long long int data, min = 1000000009, max = -1;

	for(int i = 0; i < n; i++){
		scanf("%lld", &data);

		if(data == max){cnt1++;}
		if(data == min){cnt2++;}

		if(data > max){max = data;cnt1 = 1;}
		if(data < min){min = data;cnt2 = 1;}
	}

	if(max==min){printf("0 %d", n * (n - 1) / 2);}
    else printf("%lld %d", max - min, cnt1 * cnt2);

}


#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>

int cmp(const void *a, const void *b)
{
     return(*(int *)a-*(int *)b);
}

/*int gcd(int a,int b)
{
    return b ? gcd(b,a%b) : a;
}*/
int main()
{
    int n,i,k = 0,l = 0,a[100008] = {0},r = 1,t = 100000000;
    scanf("%d",&n);
    for(i = 0; i < n; i++)
    {
        scanf("%d",&a[i]);
        if(a[i] > r)
        {
            r = a[i];
            k = 1;
        }
        else if(a[i] == r)
        {
            k++;
        }
        if(a[i] < t)
        {
            t = a[i];
            l = 1;
        }
        else if(a[i] == t)
        {
            l++;
        }

    }
    qsort(a,n,sizeof(a[0]),cmp);
    printf("%d %d",a[n-1]-a[0],r==t?(n*(n-1))/2:k*l);
    return 0;
}


#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>

int cmp(const void *a, const void *b)
{
     return(*(int *)a-*(int *)b);
}

/*int gcd(int a,int b)
{
    return b ? gcd(b,a%b) : a;
}*/
int main()
{
    int n,i,k = 1,l = 1,a[100008] = {0};
    scanf("%d",&n);
    for(i = 0; i < n; i++)
    {
        scanf("%d",&a[i]);
    }
    qsort(a,n,sizeof(a[0]),cmp);
    for(i = 1; i < n; i++)
    {
       if(a[i] != a[i-1])
       {
           break;
       }
       else
       {
           k++;
       }
    }
    for(i = n - 2; i > 0; i--)
    {
        if(a[i] != a[i+1])
        {
            break;
        }
        else
        {
            l++;
        }
    }
    printf("%d %d",a[n-1]-a[0],k*l);
    return 0;
}


#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>

/*int cmp(const void *a, const void *b)
{
     return(*(int *)a-*(int *)b);
}*/

/*int gcd(int a,int b)
{
    return b ? gcd(b,a%b) : a;
}*/
int main()
{
    long long min=1000000000,max=1,n,i,b,maxc=0,minc=0;
    scanf("%I64d",&n);
    for(i = 0; i < n; i++)
    {
        scanf("%I64d",&b);
        if(b > max)
        {
            max = b;
            maxc = 1;
        }
        else if(b == max)
        {
           maxc++;
        }
        if(b < min)
        {
            min = b;
            minc = 1;
        }
        else if(b == min)
        {
            minc++;
        }
    }
    printf("%I64d %I64d\n",max-min,min==max?(n*(n-1))/2:maxc*minc);
    return 0;
}


#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>

/*int cmp(const void *a, const void *b)
{
     return(*(int *)a-*(int *)b);
}*/

/*int gcd(int a,int b)
{
    return b ? gcd(b,a%b) : a;
}*/
int main()
{
    int n,i,k = 0,l = 0,a[100008] = {0},r = 1,t = 100000000;
    scanf("%d",&n);
    for(i = 0; i < n; i++)
    {
        scanf("%d",&a[i]);
        if(a[i] > r)
        {
            r = a[i];
            k = 1;
        }
        else if(a[i] == r)
        {
            k++;
        }
        if(a[i] < t)
        {
            t = a[i];
            l = 1;
        }
        else if(a[i] == t)
        {
            l++;
        }

    }
    printf("%d %d",r-t,r==t?(n*(n-1))/2:k*l);
    return 0;
}


#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>

int cmp(const void *a, const void *b)
{
     return(*(int *)a-*(int *)b);
}

/*int gcd(int a,int b)
{
    return b ? gcd(b,a%b) : a;
}*/
int main()
{
    int n,i,k = 0,l = 0,a[100008] = {0},r = 1,t = 100000000;
    scanf("%d",&n);
    for(i = 0; i < n; i++)
    {
        scanf("%d",&a[i]);
        if(a[i] > r)
        {
            r = a[i];
            k = 1;
        }
        else if(a[i] == r)
        {
            k++;
        }
        if(a[i] < t)
        {
            t = a[i];
            l = 1;
        }
        else if(a[i] == t)
        {
            l++;
        }

    }
    qsort(a,n,sizeof(a[0]),cmp);
    printf("%d %d",a[n-1]-a[0],k==l?(n*(n-1))/2:k*l);
    return 0;
}


#include<stdio.h>
int main()
{
        int x=1,y=1,count=0,n,i,temp,j,max,min;
        scanf("%d",&n);
        int diff=0,b[n];
        for(i=0;i<n;i++)
                scanf("%d",&b[i]);
        i=0;
        while(i<n)
        {
                min=i;
                for(j=i+1;j<n;j++)
                        if(b[j]<b[min])
                                min=j;
                temp=b[i];
                b[i]=b[min];
                b[min]=temp;
                max=n-1-i;
                for(j=n-2-i;j>=0;j--)
                        if(b[j]>b[max])
                                max=j;
                temp=b[n-1-i];
                b[n-1-i]=b[max];
                b[max]=temp;

                if(i>0 && b[n-1]==b[n-1-i])
                        x++;
                if(i>0 && b[1]==b[i])
                        y++;
                if(diff<=b[n-1-i]-b[i])
                {
                        diff=b[n-1-i]-b[i];
                        i++;
                        count=x*y;
                }

                else
                        break;
        }
printf("%d %d",diff,count);
return 0;
}


#include<stdio.h>
int main()
{
	long long int x=1,y=1;
	int n,i,temp,j,max,min;
	long long count=0;
	scanf("%d",&n);
	int diff=0,b[n];
	for(i=0;i<n;i++)
		scanf("%d",&b[i]);
	i=0;
	while(i<n)
	{
		min=i;
		for(j=i+1;j<n;j++)
			if(b[j]<b[min])
				min=j;
		temp=b[i];
		b[i]=b[min];
		b[min]=temp;
		max=n-1-i;
		for(j=n-2-i;j>=0;j--)
			if(b[j]>b[max])
				max=j;
		temp=b[n-1-i];
		b[n-1-i]=b[max];
		b[max]=temp;

		if(i>0)
		{
			for(j=1;j<n;j++)
			if(b[j]==b[0])
				x++;
			for(j=n-2;j>=0;j--)
			if(b[j]==b[n-1])
				y++;
		}
		diff=b[n-1]-b[0];
		if(i>0)
		{
			if(b[n-1]==b[0])
				count=(n*(n-1))/2;
			else
				count=x*y;
			break;
		}
		i++;
	}

	printf("%d %lld",diff,count);
	return 0;
}


#include<stdio.h>
int main()
{
	int x=1,y=1,count=0,n,i,temp,j,max,min;
	scanf("%d",&n);
	int diff=0,b[n];
	for(i=0;i<n;i++)
		scanf("%d",&b[i]);
	i=0;
	while(i<n)
	{
		min=i;
		for(j=i+1;j<n;j++)
			if(b[j]<b[min])
				min=j;
		temp=b[i];
		b[i]=b[min];
		b[min]=temp;
		max=n-1-i;
		for(j=n-2-i;j>=0;j--)
			if(b[j]>b[max])
				max=j;
		temp=b[n-1-i];
		b[n-1-i]=b[max];
		b[max]=temp;

		if(i>0)
		{
			for(j=1;j<n;j++)
			if(b[j]==b[0])
				x++;
			for(j=n-2;j>=0;j--)
			if(b[j]==b[n-1])
				y++;
		}
		diff=b[n-1]-b[0];
		if(i>0)
		{
			count=x*y;
			break;
		}
		i++;
	}

	printf("%d %d",diff,count);
	return 0;
}


#include<stdio.h>
int main()
{
	long long int x=1,y=1;
	int i,temp,j,max,min;
	long long int n;
	long long int count=0;
	scanf("%lld",&n);
	int diff=0,b[n];
	for(i=0;i<n;i++)
		scanf("%d",&b[i]);
	i=0;
	while(i<n)
	{
		min=i;
		for(j=i+1;j<n;j++)
			if(b[j]<b[min])
				min=j;
		temp=b[i];
		b[i]=b[min];
		b[min]=temp;
		max=n-1-i;
		for(j=n-2-i;j>=0;j--)
			if(b[j]>b[max])
				max=j;
		temp=b[n-1-i];
		b[n-1-i]=b[max];
		b[max]=temp;

		if(i>0)
		{
			for(j=1;j<n;j++)
			if(b[j]==b[0])
				x++;
			for(j=n-2;j>=0;j--)
			if(b[j]==b[n-1])
				y++;
		}
		diff=b[n-1]-b[0];
		if(i>0)
		{
			if(b[n-1]==b[0])
				count=(n*(n-1))/2;
			else
				count=x*y;
			break;
		}
		i++;
	}

	printf("%d %lld",diff,count);
	return 0;
}


#include<stdio.h>
int main()
{
	int x=1,y=1,n,i,temp,j,max,min;
	long long count=0;
	scanf("%d",&n);
	int diff=0,b[n];
	for(i=0;i<n;i++)
		scanf("%d",&b[i]);
	i=0;
	while(i<n)
	{
		min=i;
		for(j=i+1;j<n;j++)
			if(b[j]<b[min])
				min=j;
		temp=b[i];
		b[i]=b[min];
		b[min]=temp;
		max=n-1-i;
		for(j=n-2-i;j>=0;j--)
			if(b[j]>b[max])
				max=j;
		temp=b[n-1-i];
		b[n-1-i]=b[max];
		b[max]=temp;

		if(i>0)
		{
			for(j=1;j<n;j++)
			if(b[j]==b[0])
				x++;
			for(j=n-2;j>=0;j--)
			if(b[j]==b[n-1])
				y++;
		}
		diff=b[n-1]-b[0];
		if(i>0)
		{
			count=x*y;
			break;
		}
		i++;
	}

	printf("%d %lld",diff,count);
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main() {
  int n;
  long long int repmin=1,repmax=1;
  long long int a,max=0,min;
  scanf("%I64d",&n);
  scanf("%I64d",&a);
  max=min=a;
  int temp=n--;
  while (n) {
    scanf("%I64d",&a);
    if(a<min){
      min=a;
      repmin=1;
    }
    else if(a==min)repmin++;
    if(a>max){
      max=a;
      repmax=1;
    }
    else if(a==max)repmax++;

    n--;
  }
  if(min==max&&temp%2==0)printf("%I64d %I64d",max-min,repmax/2 *(repmax-repmax/2));
  else
  printf("%I64d %I64d",max-min,repmax*repmin);
  return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main() {
  int n;
  long long int repmin=1,repmax=1;
  long long int a,max=0,min;
  scanf("%I64d",&n);
  scanf("%I64d",&a);
  max=min=a;
  int temp=n--;
  while (n) {
    scanf("%I64d",&a);
    if(a<min){
      min=a;
      repmin=1;
    }
    else if(a==min)repmin++;
    if(a>max){
      max=a;
      repmax=1;
    }
    else if(a==max)repmax++;

    n--;
  }
  if(min==max)printf("%I64d %I64d",max-min,repmax*(repmax-1)/2);
  else
  printf("%I64d %I64d",max-min,repmax*repmin);
  return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
  int n,repmin=1,repmax=1;
  long long int a,max=0,min;
  scanf("%d",&n);
  scanf("%I64d",&a);
  max=min=a;
  while (n-1) {
    scanf("%I64d",&a);
    if(a<min){
      min=a;
      repmin=1;
    }
    else if(a==min)repmin++;
    if(a>max){
      max=a;
      repmax=1;
    }
    else if(a==max)repmax++;

    n--;
  }
  printf("%I64d %d",max-min,repmax*repmin);
  return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
  int n;
  long long int repmin=1,repmax=1;
  long long int a,max=0,min;
  scanf("%I64d",&n);
  scanf("%I64d",&a);
  max=min=a;
  while (n-1) {
    scanf("%I64d",&a);
    if(a<min){
      min=a;
      repmin=1;
    }
    else if(a==min)repmin++;
    if(a>max){
      max=a;
      repmax=1;
    }
    else if(a==max)repmax++;

    n--;
  }
  printf("%I64d %I64d",max-min,repmax*repmin);
  return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
  int n,repmin=1,repmax=1;
  long long int a,max=0,min;
  scanf("%lI64d",&n);
  scanf("%I64I64d",&a);
  max=min=a;
  while (n-1) {
    scanf("%I64I64d",&a);
    if(a<min){
      min=a;
      repmin=1;
    }
    else if(a==min)repmin++;
    if(a>max){
      max=a;
      repmax=1;
    }
    else if(a==max)repmax++;

    n--;
  }
  printf("%I64I64d %lld",max-min,repmax*repmin);
  return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
  int n;
  long long int repmin=1,repmax=1;
  long long int a,max=0,min;
  scanf("%I64d",&n);
  scanf("%I64d",&a);
  max=min=a;
  int temp=n--;
  while (n) {
    scanf("%I64d",&a);
    if(a<min){
      min=a;
      repmin=1;
    }
    else if(a==min)repmin++;
    if(a>max){
      max=a;
      repmax=1;
    }
    else if(a==max)repmax++;

    n--;
  }
  if(min==max&&temp%2==0)printf("%I64d %I64d",max-min,repmax);
  else if(max==min&&temp%2==1)printf("%I64d %I64d",max-min,((repmax+2)/2)*(repmax/2) );
  else
  printf("%I64d %I64d",max-min,repmax*repmin);
  return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
  int n,repmin=1,repmax=1;
  long long int a,max=0,min;
  scanf("%I64d",&n);
  scanf("%I64d",&a);
  max=min=a;
  while (n-1) {
    scanf("%I64d",&a);
    if(a<min){
      min=a;
      repmin=1;
    }
    else if(a==min)repmin++;
    if(a>max){
      max=a;
      repmax=1;
    }
    else if(a==max)repmax++;

    n--;
  }
  printf("%I64d %I64d",max-min,repmax*repmin);
  return 0;
}


#include<stdio.h>
int main()
{ long int n,i,a[200001],max,min,m=0,mi=0;
	scanf("%ld",&n);
	for(i=0; i<n; i++) scanf("%ld",&a[i]);
	max=a[0]; min=a[0];
	for(i=0; i<n; i++) {
	if(a[i]>max) max=a[i]; else {
									if (a[i]<min) min=a[i];}}
	for(i=0; i<n; i++) {if(a[i]==max) m++; else {
									if (a[i]==min) mi++;}
	}
		if(max==min) printf("%ld %ld",max-min,(n*(n-1))/2); else printf("%ld %ld",max-min,m*mi);
	}


#include<stdio.h>
int main()
{ long int n,i,a[200001],max,min,m=0,mi=0;
	scanf("%ld",&n);
	for(i=0; i<n; i++) scanf("%ld",&a[i]);
	max=a[0]; min=a[0];
	for(i=0; i<n; i++) {
	if(a[i]>max) max=a[i]; else {
									if (a[i]<min) min=a[i];}}
	for(i=0; i<n; i++) {if(a[i]==max) m++; else {
									if (a[i]==min) mi++;}
	}
		printf("%ld %ld",max-min,m*mi);
	}


#include<stdio.h>
int main()
{ int n,i,a[1000],max,min,m=0,mi=0;
	scanf("%d",&n);
	for(i=0; i<n; i++) scanf("%d",&a[i]);
	max=a[0]; min=a[0];
	for(i=0; i<n; i++) {
	if(a[i]>max) max=a[i]; else {
									if (a[i]<min) min=a[i];}}
	for(i=0; i<n; i++) {if(a[i]==max) m++; else {
									if (a[i]==min) mi++;}
	}
		printf("%d %d",max-min,m*mi);
	}


#include<stdio.h>
int main()
{ long int n,i,a[200001],max,min,m=0,mi=0;
	scanf("%ld",&n);
	for(i=0; i<n; i++) scanf("%ld",&a[i]);
	max=a[0]; min=a[0];
	for(i=0; i<n; i++) {
	if(a[i]>max) max=a[i]; else {
									if (a[i]<min) min=a[i];}}
	for(i=0; i<n; i++) {if(a[i]==max) m++; else {
									if (a[i]==min) mi++;}
	}
		if(max==min) printf("%ld %l d",max-min,(n*(n-1))/2); else printf("%ld %l d",max-min,m*mi);
	}


#include<stdio.h>
int main()
{ long long int n,i,a[200009],max,min,m=0,mi=0;
	scanf("%lld",&n);
	for(i=0; i<n; i++) scanf("%lld",&a[i]);
	max=a[0]; min=a[0];
	for(i=0; i<n; i++) {
	if(a[i]>max) max=a[i]; else {
									if (a[i]<min) min=a[i];}}
	for(i=0; i<n; i++) {if(a[i]==max) m++; else {
									if (a[i]==min) mi++;}
	}
		if(max==min) printf("%lld %lld",max-min,(n*(n-1))/2); else printf("%lld %lld",max-min,m*mi);
	}


#include<stdio.h>
int main()
{ int n,i,a[200001],max,min,m=0,mi=0;
	scanf("%d",&n);
	for(i=0; i<n; i++) scanf("%d",&a[i]);
	max=a[0]; min=a[0];
	for(i=0; i<n; i++) {
	if(a[i]>max) max=a[i]; else {
									if (a[i]<min) min=a[i];}}
	for(i=0; i<n; i++) {if(a[i]==max) m++; else {
									if (a[i]==min) mi++;}
	}
		printf("%d %d",max-min,m*mi);
	}


#include<stdio.h>
int main()
{ long int n,i,a[200009],max,min,m=0,mi=0;
	scanf("%ld",&n);
	for(i=0; i<n; i++) scanf("%ld",&a[i]);
	max=a[0]; min=a[0];
	for(i=0; i<n; i++) {
	if(a[i]>max) max=a[i]; else {
									if (a[i]<min) min=a[i];}}
	for(i=0; i<n; i++) {if(a[i]==max) m++; else {
									if (a[i]==min) mi++;}
	}
		if(max==min) printf("%ld %ld",max-min,(n*(n-1))/2); else printf("%ld %ld",max-min,m*mi);
	}


#include<stdio.h>

int main()
{
	long long n, t, cmax=0, cmin=0, a[200000], i, max, min;
	scanf("%lld", &n);
	for(i=0; i<n; i++)
	scanf("%lld", &a[i]);
	min=max=a[0];
	for(i=0; i<n; i++)
	{
		if(a[i]>max)
		max=a[i];
		else
		min=a[i];
	}
	for(i=0; i<n; i++)
	{

			if(a[i]==max)
		    cmax++;
		    if(a[i]==min)
		    cmin++;
	}
	if(max==min)
	t=n*(n-1)/2;
	else
	t=cmax*cmin;
	printf("%lld %lld", max-min, t);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

int main()
{
	long long i, n, *b, w, cmax=0, cmin=0, max, min;

	scanf("%lld", &n);

	b = (long long *)malloc(n * sizeof(long long));

	for(i=0; i<n; i++)
	{
		scanf("%lld", &b[i]);
		if(i==0)
		max = min = b[i];

		else if(b[i]>max)
		max = b[i];

		else if(b[i]<min)
		min = b[i];
	}
	if(max==min)
	w = n*(n-1)/2;

	else
	{
		for(i=0; i<n; i++)
		{
			if(b[i]==max)
			cmax++;

			else if(b[i]==min)
			cmin++;
		}
		w = cmax*cmin;
	}
	printf("%lld %lld", max-min, w);

	free(b);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

int main()
{
	int n, *a, i, max, min, cmax=0, cmin=0;
	long long t;
	scanf("%d", &n);
	a = (int *)malloc(n*sizeof(int));
	for(i=0; i<n; i++)
	scanf("%d", &a[i]);
	min=max=a[0];
	for(i=0; i<n; i++)
	{
		if(a[i]>max)
		max=a[i];
		else
		min=a[i];
	}
	for(i=0; i<n; i++)
	{
		if(a[i]==max)
		cmax++;
		if(a[i]==min)
		cmin++;
	}
	t=cmax*cmin;
	printf("%d %lld", max-min, t);
	free(a);
	return 0;
}


#include<stdio.h>

int main()
{
	int n, a[200000], i, max, min, cmax=0, cmin=0;
	long long t;
	scanf("%d", &n);
	for(i=0; i<n; i++)
	scanf("%d", &a[i]);
	min=max=a[0];
	for(i=0; i<n; i++)
	{
		if(a[i]>max)
		max=a[i];
		else
		min=a[i];
	}
	for(i=0; i<n; i++)
	{
		if(a[i]==max)
		cmax++;
		if(a[i]==min)
		cmin++;
	}
	t=cmax*cmin;
	printf("%d %lld", max-min, t);
	return 0;
}


#include<stdio.h>

int main()
{
	int a[200000], i, max, min;
	long long n, t, cmax=0, cmin=0;
	scanf("%lld", &n);
	for(i=0; i<n; i++)
	scanf("%d", &a[i]);
	min=max=a[0];
	for(i=0; i<n; i++)
	{
		if(a[i]>max)
		max=a[i];
		else
		min=a[i];
	}
	for(i=0; i<n; i++)
	{

			if(a[i]==max)
		    cmax++;
		    if(a[i]==min)
		    cmin++;
	}
	if(max==min)
	t=n*(n-1)/2;
	else
	t=cmax*cmin;
	printf("%d %lld", max-min, t);
	return 0;
}


#include<stdio.h>

int main()
{
	int n, a[200000], i, max, min;
	long long cmax=0, cmin=0;
	scanf("%d", &n);
	for(i=0; i<n; i++)
	scanf("%d", &a[i]);
	min=max=a[0];
	for(i=0; i<n; i++)
	{
		if(a[i]>max)
		max=a[i];
		else
		min=a[i];
	}
	for(i=0; i<n; i++)
	{
		if(a[i]==max)
		cmax++;
		if(a[i]==min)
		cmin++;
	}
	printf("%d %lld", max-min, cmax*cmin);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

int main()
{
	int n, *a, i, max, min, cmax=0, cmin=0;
	scanf("%d", &n);
	a = (int *)malloc(n*sizeof(int));
	for(i=0; i<n; i++)
	scanf("%d", &a[i]);
	min=max=a[0];
	for(i=0; i<n; i++)
	{
		if(a[i]>max)
		max=a[i];
		else
		min=a[i];
	}
	for(i=0; i<n; i++)
	{
		if(a[i]==max)
		cmax++;
		if(a[i]==min)
		cmin++;
	}
	printf("%d %d", max-min, cmax*cmin);
	free(a);
	return 0;
}


#include<stdio.h>
#define ll long long
int main()
{
    ll n,d,i,mt=0,mxt=0,cnt=0,cnt1=0,b,min=100005,max=0;
    scanf("%lld",&n);
    ll a[n];
    for(i=0; i<n; i++)
    {
        scanf("%lld",&a[i]);
        b=a[i];
        if(b<=min)
            min=b;
        if(b>=max)
            max=b;
    }
    for(i=0; i<n; i++)
    {
        if(a[i]==max)
        {
            cnt++;
        }
        else if(a[i]==min)
        {
            cnt1++;
        }
    }
    if(cnt==n)
    {
        ll m=(n*(n-1))/2;
        printf("0 %lld",m);
    }
    else
    {
        ll ma=cnt*cnt1;
        d=max-min;
        printf("%lld %lld\n",d,ma);
        return 0;
    }
}


#include<stdio.h>
#define ll long long
int main()
{
    ll n,d,i,mt=0,mxt=0,cnt=0,cnt1=0,b,min=1000005,max=0;
    scanf("%lld",&n);
    ll a[n];
    for(i=0; i<n; i++)
    {
        scanf("%lld",&a[i]);
        b=a[i];
        if(b<=min)
            min=b;
        if(b>=max)
            max=b;
    }
    for(i=0; i<n; i++)
    {
        if(a[i]==max)
        {
            cnt++;
        }
        else if(a[i]==min)
        {
            cnt1++;
        }
    }
    if(cnt==n)
    {
        ll m=(n*(n-1))/2;
        printf("0 %lld",m);
    }
    else
    {
        ll ma=cnt*cnt1;
        d=max-min;
        printf("%lld %lld\n",d,ma);
        return 0;
    }
}


#include<stdio.h>
#define ll long long
int main()
{
    ll n,d,i,mt=0,mxt=0,cnt=0,cnt1=0,b,min=10000005,max=0;
    scanf("%lld",&n);
    ll a[n];
    for(i=0; i<n; i++)
    {
        scanf("%lld",&a[i]);
        b=a[i];
        if(b<=min)
            min=b;
        if(b>=max)
            max=b;
    }
    for(i=0; i<n; i++)
    {
        if(a[i]==max)
        {
            cnt++;
        }
        else if(a[i]==min)
        {
            cnt1++;
        }
    }
    if(cnt==n)
    {
        ll m=(n*(n-1))/2;
        printf("0 %lld",m);
    }
    else
    {
        ll ma=cnt*cnt1;
        d=max-min;
        printf("%lld %lld\n",d,ma);
        return 0;
    }
}


#include<stdio.h>
void swap(int *a,int *b)
{
int temp=*a;
*a=*b;
*b=temp;
}
void sort(int a[],int l,int x)
{
if(l>=x)
return;
int c=l,pivot=a[x];
for(int i=l;i<=x;i++)
{
if(a[i]<=pivot)
{
swap(&a[c],&a[i]);
c++;
}
}
sort(a,l,c-2);
sort(a,c,x);
}
int main()
{
    int n,x=0,y=0,f=1,g=1;
    scanf("%d",&n);
    int ar[n];
    for(int i=0;i<n;i++)
    scanf("%d",&ar[i]);
    sort(ar,0,n-1);
    if(ar[0]==ar[n-1])
    {x=0;
    y=0;}
    else
    {
    for(int i=0;i<n;i++)
    {
    if(ar[0]==ar[i])
    x++;
    else
    f=0;
    if(ar[n-1]==ar[n-1-i])
    y++;
    else
    g=0;
    if(f==0&&g==0)
    break;
    }
    }
    printf("%d %d",ar[n-1]-ar[0],x*y);
    return 0;
}


#include<stdio.h>
int main()
{
    int n,x=0,y=0,a=1,b=1;
    scanf("%d",&n);
    int ar[n];
    for(int i=0;i<n;i++)
    {
    scanf("%d",&ar[i]);
    if(ar[i]>a)
    a=ar[i];
    if(ar[i]<b)
    b=ar[i];
    }
    if(a==b)
    {x=1;
    y=1;}
    else
    {
    for(int i=0;i<n;i++)
    {
    if(ar[i]==a)
    x++;
    else if(ar[i]==b)
    y++;
    }
    }
    printf("%d %d",a-b,x*y);
    return 0;
}


#include<stdio.h>
int main()
{
    long long n,a=1,b=1000000000;
    scanf("%lld",&n);
    long long ar[n];
    long long x=0,y=0,acnt=0,bcnt=0;
    for(long long i=0;i<n;i++)
    {
    scanf("%lld",&ar[i]);
    if(ar[i]>a)
    a=ar[i];
    if(ar[i]<b)
    b=ar[i];
    }
    for(long long i=0;i<n;i++)
    {
    if(ar[i]==a)
    acnt++;
    else if(ar[i]==b)
    bcnt++;
    }
    if(a==b)
    x=(acnt*(acnt-1))/2;
    else
    x=acnt*bcnt;
    /*{
    for(int i=0;i<n;i++)
    {
    if(ar[i]==a)
    x++;
    else if(ar[i]==b)
    y++;
    }
    x=x*y;
    }*/
    long long res=a-b;
    printf("%lld %lld",res,x);
    return 0;
}


#include<stdio.h>
int main()
{
    int n,a=1,b=1;
    scanf("%d",&n);
    int ar[n];
    long x=0,y=0;
    for(int i=0;i<n;i++)
    {
    scanf("%d",&ar[i]);
    if(ar[i]>a)
    a=ar[i];
    if(ar[i]<b)
    b=ar[i];
    }
    if(a==b)
    {
    for(int i=1;i<n;i++)
    x+=i;
    }
    else
    {
    for(int i=0;i<n;i++)
    {
    if(ar[i]==a)
    x++;
    else if(ar[i]==b)
    y++;
    }
    x=x*y;
    }
    printf("%d %ld",a-b,x);
    return 0;
}


#include<stdio.h>
int main()
{
    int n,x=0,y=0,a=1,b=1;
    scanf("%d",&n);
    int ar[n];
    for(int i=0;i<n;i++)
    {
    scanf("%d",&ar[i]);
    if(ar[i]>a)
    a=ar[i];
    if(ar[i]<b)
    b=ar[i];
    }
    if(a==b)
    {
    for(int i=1;i<n;i++)
    x+=i;
    }
    else
    {
    for(int i=0;i<n;i++)
    {
    if(ar[i]==a)
    x++;
    else if(ar[i]==b)
    y++;
    }
    x=x*y;
    }
    printf("%d %d",a-b,x);
    return 0;
}


#include<stdio.h>
int main()
{
    long long n,a=1,b=1;
    scanf("%lld",&n);
    long long ar[n];
    long long x=0,y=0;
    for(int i=0;i<n;i++)
    {
    scanf("%lld",&ar[i]);
    if(ar[i]>a)
    a=ar[i];
    if(ar[i]<b)
    b=ar[i];
    }
    if(a==b)
    {
    for(int i=1;i<n;i++)
    x+=i;
    }
    else
    {
    for(int i=0;i<n;i++)
    {
    if(ar[i]==a)
    x++;
    else if(ar[i]==b)
    y++;
    }
    x=x*y;
    }
    printf("%lld %lld",a-b,x);
    return 0;
}


#include<stdio.h>
int main()
{
    int n,x=0,y=0,a=1,b=1;
    scanf("%d",&n);
    int ar[n];
    for(int i=0;i<n;i++)
    {
    scanf("%d",&ar[i]);
    if(ar[i]>a)
    a=ar[i];
    if(ar[i]<b)
    b=ar[i];
    }
    if(a==b)
    {x=0;
    y=0;}
    else
    {
    for(int i=0;i<n;i++)
    {
    if(ar[i]==a)
    x++;
    else if(ar[i]==b)
    y++;
    }
    }
    printf("%d %d",a-b,x*y);
    return 0;
}


#include<stdio.h>
int main()
{
    long long int n,max_d,max_num=0,i,min_t=0,max_t=0;
    scanf("%lld",&n);
    int a[n];
    for(i=0; i<n; i++)
    {
        scanf("%lld",&a[i]);
    }
    if(a[0]==a[n-1])
    {
        if(n%2==0)
            max_num=(n/2*(n-1));
        else
            max_num=(n/2*n);
    }
    else
    {
        for(i=0; i<n; i++)
        {

            if(a[i]==a[0])
                min_t++;
            if(a[i]==a[n-1])
                max_t++;
        }
        max_num=min_t*max_t;

    }
    max_d=a[n-1]-a[0];
    if(max_d<0) max_d=max_d*(-1);
    printf("%lld %lld\n",max_d,max_num);
    return 0;
}


#include <stdio.h>
int main(){
    long long int a,b,l=9999999,h=0,lc=1,hc=1;
    scanf("%lld" ,&a);
    while(a--){
      scanf("%lld" ,&b);
	  if(l>b) l=b;
	  else if(b==l)lc++;
	  if(h<b) h=b;
	  else if(b==h)hc++;
	}
	//printf("lc= %lld hc=%lld\n\n" ,lc ,hc);
	printf("%lld %lld" ,h-l ,hc*lc);
	return 0;
}


#include <stdio.h>
int main(){
    long long int a,b,l=9999999,h=0,lc=1,hc=1;
    scanf("%lld" ,&a);
    while(a--){
      scanf("%lld" ,&b);
	  if(l>b) l=b;
	  else if(b==l)lc++;
	  if(h<b) h=b;
	  else if(b==h)hc++;
	}
	//printf("lc= %lld hc=%lld\n\n" ,lc ,hc);
	if(h!=l)
	printf("%lld %lld" ,h-l ,hc*lc);
	else
	printf("%lld 1" ,h-l);
	return 0;
}


#include<stdio.h>
int main(){
   long long int n;
   scanf("%lld" ,&n);
   long long int a[n],i,h=-1,l=99999999999,hc=0,lc=0;
    for(i=0;i<n;i++)
     {
         scanf("%lld" ,&a[i]);
         if(a[i]>h)
            h=a[i],hc=1;
         else if(a[i]==h)
            hc++;
         if(a[i]<l)
            l=a[i],lc=1;
         else if(a[i]==l)
            lc++;
     }
     if(h==l)
        printf("0 %lld" ,(lc-1)*(lc)/2);
    else
        printf("%lld %lld" ,h-l ,hc*lc);

return 0;
}


#include <stdio.h>
int main(){
    long long int a,b,l=99999999999,h=0,lc=1,hc=1;
    scanf("%lld" ,&a);
    while(a--){
      scanf("%lld" ,&b);
	  if(l>b) l=b;
	  else if(b==l)lc++;
	  if(h<b) h=b;
	  else if(b==h)hc++;
	}
	//printf("lc= %lld hc=%lld\n\n" ,lc ,hc);
	if(h!=l)
	printf("%lld %lld" ,h-l ,hc*lc);
	else
	printf("%lld %lld" ,h-l ,hc*(hc-1)/2);
	return 0;
}


#include<stdio.h>

int main(){
    long long int count,x;
    scanf("%lld",&count);
   long long int i,number[count];
   long long int  min=1000000000,max=1;
   for(i=0;i<count;i++)
   {
      scanf("%lld",&number[i]);
      if (number[i]>max)
        max=number[i];
      if (number[i]<min)
        min=number[i];
   }

   long long int n1=0,n2=0;
   i=0;
   while(i<count)
   {
       if (number[i]==min)
        n1++;
       if (number[i]==max)
        n2++;
        i++;
   }
   if (min!=max)
   printf("%lld %lld",max-min,n2*n1);
    else
    printf("%lld %lld",max-min,n1*(n1+1)/2);
   return 0;
}


#include<stdio.h>
void quicksort(int number[25],int first,int last){
   int i, j, pivot, temp;

   if(first<last){
      pivot=first;
      i=first;
      j=last;

      while(i<j){
         while(number[i]<=number[pivot]&&i<last)
            i++;
         while(number[j]>number[pivot])
            j--;
         if(i<j){
            temp=number[i];
            number[i]=number[j];
            number[j]=temp;
         }
      }

      temp=number[pivot];
      number[pivot]=number[j];
      number[j]=temp;
      quicksort(number,first,j-1);
      quicksort(number,j+1,last);

   }
}

int main(){
    int count;
    scanf("%d",&count);
   int i,number[count];

   for(i=0;i<count;i++)
      scanf("%d",&number[i]);

   quicksort(number,0,count-1);

   int n1=1,n2=1;
   i=1;
   while(number[i]==number[i-1])
   {
        n1++;
        i++;
   }
   i=count-2;
   while(number[i]==number[i+1])
   {
       n2++;
       i--;
   }
   printf("%d %d",number[count-1]-number[0],n2*n1);

   return 0;
}


#include<stdio.h>

int main(){
    long long int count;
    scanf("%lld",&count);
   long long int i,number[count];
   long long int  min=1000000000,max=1;
   for(i=0;i<count;i++)
   {
      scanf("%lld",&number[i]);
      if (number[i]>max)
        max=number[i];
      if (number[i]<min)
        min=number[i];
   }

   long long int n1=0,n2=0;
   i=0;
   while(i<count)
   {
       if (number[i]==min)
        n1++;
       if (number[i]==max)
        n2++;
        i++;
   }
   if (min!=max)
   printf("%lld %lld",max-min,n2*n1);
    else
    printf("%lld %lld",max-min,n1*(n1+1)/2);
   return 0;
}


#include<stdio.h>

int main(){
    int count;
    scanf("%d",&count);
   int i,number[count];
    int  min=999999999,max=0;
   for(i=0;i<count;i++)
   {
      scanf("%d",&number[i]);
      if (number[i]>max)
        max=number[i];
      if (number[i]<min)
        min=number[i];
   }

   int n1=0,n2=0;
   i=0;
   while(i<count)
   {
       if (number[i]==min)
        n1++;
       if (number[i]==max)
        n2++;
        i++;
   }

   printf("%d %d",max-min,n2*n1);

   return 0;
}


#include<stdio.h>

int main(){
    int count;
    scanf("%d",&count);
   int i,number[count];
    int  min=1000000000,max=0;
   for(i=0;i<count;i++)
   {
      scanf("%d",&number[i]);
      if (number[i]>max)
        max=number[i];
      if (number[i]<min)
        min=number[i];
   }

   int n1=0,n2=0;
   i=0;
   while(i<count)
   {
       if (number[i]==min)
        n1++;
       if (number[i]==max)
        n2++;
        i++;
   }

   printf("%d %d",max-min,n2*n1);

   return 0;
}


#include<stdio.h>

int main(){
    long long int count;
    scanf("%lld",&count);
   long long int i,number[count];
   long long int  min=1000000000,max=1;
   for(i=0;i<count;i++)
   {
      scanf("%lld",&number[i]);
      if (number[i]>max)
        max=number[i];
      if (number[i]<min)
        min=number[i];
   }

   long long int n1=0,n2=0;
   i=0;
   while(i<count)
   {
       if (number[i]==min)
        n1++;
       if (number[i]==max)
        n2++;
        i++;
   }

   printf("%lld %lld",max-min,n2*n1);

   return 0;
}


#include<stdio.h>

int main(){
    long long int count;
    scanf("%lld",&count);
   long long int i,number[count];
   long long int  min=1000000000,max=1;
   for(i=0;i<count;i++)
   {
      scanf("%lld",&number[i]);
      if (number[i]>max)
        max=number[i];
      if (number[i]<min)
        min=number[i];
   }

   long long int n1=0,n2=0;
   i=0;
   while(i<count)
   {
       if (number[i]==min)
        n1++;
       if (number[i]==max)
        n2++;
        i++;
   }
   if (min!=max)
   printf("%lld %lld",max-min,n2*n1);
    else
    printf("%lld %lld",max-min,n1*(n1-1)/2);
   return 0;
}


#include<stdio.h>
int main()
{
 int num;
 scanf("%d",&num);
 int arr[num],i=0;
 for (i=0;i<num;++i)
 {     scanf("%d",&arr[i]);
  }

 int j=0,temp;
 for (i=0;i<num-1;++i)
    for (j=i;j<num;++j)
     {  if (arr[j]<arr[i])
          { temp=arr[i];
            arr[i]=arr[j];
            arr[j]=temp;}}
 int n=1;
 i=1;

 while(arr[i]==arr[0]  && i<num)
      {n+=1;
       i+=1;}
 int m=1;
 j=num-2;
 while(arr[j]==arr[num-1] && arr[j]!=arr[0])
   {  m+=1;
      j-=1;}
 printf("%d %d",arr[num-1]-arr[0],m*n);
 return 0;
}


#include<stdio.h>
int main()
{
	long long num,i=0;
	scanf("%lld",&num);
	long long arr[num],max=0,min=1000000000;
	for(i=0;i<num;++i)
	{
		scanf("%lld",&arr[i]);
		if (arr[i]>max)
			 max=arr[i];
		if (arr[i]<min)
			min=arr[i];
	}
	long long countmax=0,countmin=0;
	for(i=0;i<num;++i)
	{
		if (arr[i]==max)
			countmax+=1;
		if (arr[i]==min)
			countmin+=1;
	}
	long long diff=max-min;
	long long ways=countmax*countmin;
	if (max==min)
		ways=(countmax*(countmax-1))/2;
	printf("%lld %lld",diff,ways);
	return 0;
}


#include<stdio.h>
int main()
{
	long long num,i=0;
	scanf("%lld",&num);
	long long arr[num],max=0,min=1000000000;
	for(i=0;i<num;++i)
	{
		scanf("%lld",&arr[i]);
		if (arr[i]>max)
			 max=arr[i];
		if (arr[i]<min)
			min=arr[i];
	}
	long long countmax=0,countmin=0;
	for(i=0;i<num;++i)
	{
		if (arr[i]==max)
			countmax+=1;
		if (arr[i]==min)
			countmin+=1;
	}
	long long diff=max-min;
	long long ways=countmax*countmin;
	printf("%lld %lld",diff,ways);
	return 0;
}


#include<stdio.h>
int main()
{
	long long num,i=0;
	scanf("%d",&num);
	long long arr[num],max=0,min=1000000000;
	for(i=0;i<num;++i)
	{
		scanf("%lld",&arr[i]);
		if (arr[i]>max)
			 max=arr[i];
		if (arr[i]<min)
			min=arr[i];
	}
	long long countmax=0,countmin=0;
	for(i=0;i<num;++i)
	{
		if (arr[i]==max)
			countmax+=1;
		if (arr[i]==min)
			countmin+=1;
	}
	long long diff=max-min;
	long long ways=countmax*countmin;
	printf("%lld %lld",diff,ways);
	return 0;
}


#include<stdio.h>
int main()
{
	int num,i=0;
	scanf("%d",&num);
	int arr[num],max=0,min=1000000000;
	for(i=0;i<num;++i)
	{
		scanf("%d",&arr[i]);
		if (arr[i]>max)
			 max=arr[i];
		if (arr[i]<min)
			min=arr[i];
	}
	int countmax=0,countmin=0;
	for(i=0;i<num;++i)
	{
		if (arr[i]==max)
			countmax+=1;
		if (arr[i]==min)
			countmin+=1;
	}
	int diff=max-min;
	int ways=countmax*countmin;
	printf("%d %d",diff,ways);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

long long int cmpfunc(const void * a,const void *b)
{
    return( *(long long int*) a - *(long long int*)b );
}
int main()
{
    long long int i,j,count=0,counter=0;
    long long int n;
    scanf("%lld",&n);

    long long int arr[n];
    for(i=0;i<n;i++)
    {
        scanf("%lld",&arr[i]);
    }
    qsort(arr,n,sizeof(long long int),cmpfunc);
    long long int diff;
    diff=arr[n-1]-arr[0];
    printf("%lld ",diff);

    for(i=0;i<n;i++)
    {
      if(arr[i]==arr[0])
      {
          count++;
      }
      else
      {
          break;
      }
    }
    for(j=n-1;j>=0;j--)
    {
        if(arr[j]==arr[n-1])
        {
            counter++;
        }
        else
        {
            break;
        }
    }
    printf("%lld",count*counter);

    return(0);
}


#include<stdio.h>
#include<stdlib.h>

long long int cmpfunc(const void * a,const void *b)
{
    return( *(int*) a - *(int*)b );
}
int main()
{
    long long int i,j,count=0,counter=0;
    long long int n;
    scanf("%lld",&n);

    long long int arr[n];
    for(i=0;i<n;i++)
    {
        scanf("%lld",&arr[i]);
    }
    qsort(arr,n,sizeof(long long int),cmpfunc);
    long long int diff;
    diff=arr[n-1]-arr[0];
    printf("%lld ",diff);

    for(i=0;i<n;i++)
    {
      if(arr[i]==arr[0])
      {
          count++;
      }
      else
      {
          break;
      }
    }
    for(j=n-1;j>=0;j--)
    {
        if(arr[j]==arr[n-1])
        {
            counter++;
        }
        else
        {
            break;
        }
    }
    printf("%lld",count*counter);

    return(0);
}


#include<stdio.h>
#include<stdlib.h>

long long int cmpfunc(const void * a,const void *b)
{
    return( *(long long int*) a - *(long long int*)b );
}
int main()
{
    long long int i,j,count=0,counter=0;
    long long int n;
    scanf("%lld",&n);

    long long int arr[n];
    for(i=0;i<n;i++)
    {
        scanf("%lld",&arr[i]);
    }
    qsort(arr,n,sizeof(long long int),cmpfunc);
    long long int diff;
    diff=arr[n-1]-arr[0];
    printf("%lld ",diff);

    for(i=0;i<n;i++)
    {
      if(arr[i]==arr[0])
      {
          count++;
      }
      else
      {
          break;
      }
    }
    for(j=n-1;j>=0;j--)
    {
        if(arr[j]==arr[n-1])
        {
            counter++;
        }
        else
        {
            break;
        }
    }
    if(count==n || counter==n)
    {
        long long int fact=n*(n-1)/2;
        printf("%lld",fact);
    }
    else
    {
    printf("%lld",count*counter);
    }
    return(0);
}


#include<stdio.h>
#include<stdlib.h>

long long int cmpfunc(const void * a,const void *b)
{
    return( *(int*) a - *(int*)b );
}
int main()
{
    long long int i,j,count=0,counter=0;
    long long int n;
    scanf("%lld",&n);

    long long int arr[n];
    for(i=0;i<n;i++)
    {
        scanf("%lld",&arr[i]);
    }
    qsort(arr,n,sizeof(long long int),cmpfunc);
    long long int diff;
    diff=arr[n-1]-arr[0];
    printf("%lld ",diff);

    for(i=0;i<n;i++)
    {
      if(arr[i]==arr[0])
      {
          count++;
      }
    }
    for(j=n-1;j>=0;j--)
    {
        if(arr[j]==arr[n-1])
        {
            counter++;
        }
    }
    printf("%lld",count*counter);

    return(0);
}


#include<stdio.h>
#include<stdlib.h>

int cmpfunc(const void * a,const void *b)
{
    return( *(int*) a - *(int*)b );
}
int main()
{
    int n,i,j,count=0,counter=0;
    scanf("%d",&n);

    int arr[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&arr[i]);
    }
    qsort(arr,n,sizeof(int),cmpfunc);
    int diff;
    diff=arr[n-1]-arr[0];
    printf("%d ",diff);

    for(i=0;i<n;i++)
    {
      if(arr[i]==arr[0])
      {
          count++;
      }
    }
    for(j=n-1;j>=0;j--)
    {
        if(arr[j]==arr[n-1])
        {
            counter++;
        }
    }
    printf("%d",count*counter);

    return(0);
}


#include<stdio.h>
int main()
{
    long long int n,b[1000000],i,max,min,d=0,c=0;
    scanf("%I64d",&n);
    for(i=0;i<n;i++)
    scanf("%I64d",&b[i]);
    max=b[0];
    min=b[0];
    for(i=0;i<n;i++)
    {
        if(b[i]>max)
        max=b[i];
        else if(b[i]<min)
        min=b[i];
    }
    printf("%I64d",max-min);
    for(i=0;i<n;i++)
    {
        if(b[i]==max)
        c++;
        else if(b[i]==min)
        d++;
    }
    printf("%I64d",d*c);
}


#include<stdio.h>
int main()
{
    long long int n,b[1000000],i,max,min,d=0,c=0,e=0;
    scanf("%I64d",&n);
    for(i=0;i<n;i++)
    scanf("%I64d",&b[i]);
    max=b[0];
    min=b[0];
    for(i=1;i<n;i++)
    {
        if(b[i]==b[0])
        e++;
    }
    if(e==n-1)
    printf("0 0");
    else
    {
    for(i=0;i<n;i++)
    {
        if(b[i]>max)
        max=b[i];
        else if(b[i]<min)
        min=b[i];
    }
    printf("%I64d ",max-min);
    for(i=0;i<n;i++)
    {
        if(b[i]==max)
        c++;
        else if(b[i]==min)
        d++;
    }
    printf("%I64d",d*c);
    }
}


#include<stdio.h>
int main()
{
    long long int n,b[1000000],i,max,min,d=0,c=0;
    scanf("%I64d",&n);
    for(i=0;i<n;i++)
    scanf("%I64d",&b[i]);
    max=b[0];
    min=b[0];
    for(i=0;i<n;i++)
    {
        if(b[i]>max)
        max=b[i];
        else if(b[i]<min)
        min=b[i];
    }
    printf("%I64d ",max-min);
    for(i=0;i<n;i++)
    {
        if(b[i]==max)
        c++;
        else if(b[i]==min)
        d++;
    }
    printf("%I64d",d*c);
}


#include<atdio.h>
int main()
{
    long long int n,b[1000000],i,max,min,d=0,c=0;
    scanf("%I64d",&n);
    for(i=0;i<n;i++)
    scanf("%I64d",&b[i]);
    max=b[0];
    min=b[0];
    for(i=0;i<n;i++)
    {
        if(b[i]>max)
        max=b[i];
        else if(b[i]<min)
        min=b[i];
    }
    printf("%I64d",max-min);
    for(i=0;i<n;i++)
    {
        if(b[i]==max)
        c++;
        else if(b[i]==min)
        d++;
    }
    printf("%I64d",d*c);
}


#include <stdio.h>

int main() {
    long long int n_flowers, i, num_ways = 0, biggest_num = 0, smallest_num = 10000, num_times = 0;
    scanf("%lld", &n_flowers);
    long long int beauty_n[n_flowers];

    for (i = 0; i < n_flowers; i++) {
        scanf("%lld", &beauty_n[i]);

        if (beauty_n[i] > biggest_num) {
            biggest_num = beauty_n[i];
        }
        if (beauty_n[i] < smallest_num) {
            smallest_num = beauty_n[i];
        }
    }

    long long int big_dif = biggest_num - smallest_num;

    for (i = 0; i < n_flowers; i++) {
        if (beauty_n[i] == biggest_num) {
            num_times++;
        }

        long long int beauty_dif = biggest_num - beauty_n[i];

        if (beauty_dif == big_dif) {
            num_ways++;
        }
    }

    printf("%lld %lld\n", big_dif, num_ways * num_times);

    return 0;
}


#include <stdio.h>

int main() {
    int n_flowers, beauty_n, beauty_dif, big_dif = 0, num_ways = 0;
    int i, j;
    scanf("%d", &n_flowers);
    int beauty_nums[n_flowers];

    for (i = 0; i < n_flowers; i++) {
        scanf("%d", &beauty_n);
        beauty_nums[i] = beauty_n;
    }

    for (i = 0; i < n_flowers; i++) {
        for (j = i; j < n_flowers; j++) {
            beauty_dif = beauty_nums[i] - beauty_nums[j];

            if (beauty_dif > big_dif) {
                big_dif = beauty_dif;
                num_ways = 1;
            }
            else if (beauty_dif == big_dif) {
                num_ways++;
            }
        }
    }

    printf("%d %d\n", big_dif, num_ways);

    return 0;
}


#include <stdio.h>

int main() {
    int n_flowers, beauty_n, beauty_dif, big_dif = 0, num_ways = 0;
    int i, j;
    scanf("%d", &n_flowers);
    int beauty_nums[n_flowers];

    for (i = 0; i < n_flowers; i++) {
        scanf("%d", &beauty_n);
        beauty_nums[i] = beauty_n;
    }

    for (i = 0; i < n_flowers; i++) {
        for (j = n_flowers; j != i; j--) {
            beauty_dif = beauty_nums[i] - beauty_nums[j];

            if (beauty_dif > big_dif) {
                big_dif = beauty_dif;
                num_ways = 1;
            }
            else if (beauty_dif == big_dif) {
                num_ways++;
            }
        }
    }

    printf("%d %d\n", big_dif, num_ways);

    return 0;
}


#include <stdio.h>

int main() {
    int n_flowers, beauty_n, beauty_dif, big_dif = 0, num_ways = 0;
    int i, j;
    scanf("%d", &n_flowers);
    int beauty_nums[n_flowers];

    for (i = 0; i < n_flowers; i++) {
        scanf("%d", &beauty_n);
        beauty_nums[i] = beauty_n;
    }

    for (i = 0; i < n_flowers; i++) {
        for (j = i + 1; j < n_flowers; j++) {
            beauty_dif = beauty_nums[i] - beauty_nums[j];

            if (beauty_dif > big_dif) {
                big_dif = beauty_dif;
                num_ways = 1;
            }
            else if (beauty_dif == big_dif) {
                num_ways++;
            }
        }
    }

    printf("%d %d\n", big_dif, num_ways);

    return 0;
}


#include <stdio.h>

int main() {
    int n_flowers, i, num_ways = 0, biggest_num = 0, smallest_num = 10000, num_times = 0;
    scanf("%d", &n_flowers);
    long int beauty_n[n_flowers];

    for (i = 0; i < n_flowers; i++) {
        scanf("%d", &beauty_n[i]);

        if (beauty_n[i] > biggest_num) {
            biggest_num = beauty_n[i];
        }
        if (beauty_n[i] < smallest_num) {
            smallest_num = beauty_n[i];
        }
    }

    int big_dif = biggest_num - smallest_num;

    for (i = 0; i < n_flowers; i++) {
        if (beauty_n[i] == biggest_num) {
            num_times++;
        }

        int beauty_dif = biggest_num - beauty_n[i];

        if (beauty_dif == big_dif) {
            num_ways++;
        }
    }

    printf("%d %d\n", big_dif, num_ways * num_times);

    return 0;
}