#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    PR(a*d-b*c);

    return 0;
}

/*



*/
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
//#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <time.h>
//#include <chrono>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <limits>
#include <numeric>
#include <sstream> // std::stringstream
#include <bitset>  // std::bitset<N>
//#include <type_traits>
//#include <atcoder/scc>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define RFOR(i,a,b) for(ll i=b-1;i>=a;i--)
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define REVERSE(s) reverse(s.begin(), s.end());
#define SUM(s) accumulate(s.begin(), s.end(), 0LL);
#define P pair<ll,ll>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define vint vector<int>
//#define vvint vector<vector<int>>
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define ALL(a)  (a).begin(),(a).end()
//#define int ll
ll dx[4] = { 0,1,0,-1 };
ll dy[4] = { 1,0,-1,0 };
ll ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
ll ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
double pi = 3.141592653589793;
using namespace std;


int main() {
	int n;
	cin >> n;
	vll a(n);
	rep(i, n) {
		cin >> a[i];
	}
	SORT(a);

	vll im(n);
	rep(i, n) {
		if (i == 0) {
			im[0] = a[0];
		}
		else {
			im[i] = im[i - 1] + a[i];
		}
	}

	//x=0
	ll ans = im[n - 1] * 2;
	rep(i, n) {
		ll x2 = a[i];
		ans = min(ans, n * x2 + im[n - 1] * 2
			- 2 * (im[i] + x2 * (n - i - 1)));
	}
	cout << std::fixed << std::setprecision(15) << (double)ans / (n*2) << endl;
}