#include<bits/stdc++.h>
#define pb push_back
#define int long long
using namespace std;
int tt,n,inf=1e15;

void solve(){
	cin>>n;
	int a[n+1],ans=0;
	a[0]=0;
	map<int,int> m;
	m[0]=1;
	for(int i=1;i<=n;i++){
		int x;cin>>x;
		if(i%2)a[i]=a[i-1]-x;
		else a[i]=a[i-1]+x;
		m[a[i]]++;
	}
    //	for(int i=0;i<=n;i++)cout<<m[a[i]]<<" ";
    //	cout<<'\n';
    for(int i=0;i<=n;i++){
    	int x=m[a[i]];
    	if(x){
          ans+=((x*(x-1))/2);
          m[a[i]]=0;
    	}
    }
    cout<<ans<<'\n';
	}

signed main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
    //cin>>tt;
    //while(tt--)
    solve();
}
#include<bits/stdc++.h>
using namespace std;
#define mod  1000000007
#define int long long
    
 
void solve() {
    int n;
    double ans = 100000000000000000.0;
    cin >> n;
    vector< int > v(n);
    unordered_map<int,int> pref;
    double sum = 0;
    for ( int i=0; i<n; i++ ) {
        cin >> v[i];
        sum += double(v[i]);
    }

    sort(v.begin(), v.end());

    for ( int i=0; i<n; i++ ) {
        pref[i] = pref[i-1] + v[i];
    }

    for ( int i=0; i<n; i++ ) {
        double res = double(n)*double(v[i]/double(2)) + sum;
        res -= double(pref[i]);
        res -= double(n-i-1) * double(v[i]);
        res = res / double(n);
        ans = min(ans, res);
    }
    printf("%.7lf", ans);
    // cout << setprecision(7) << ans << '\n';
}
 
signed main() {
    
 
 
    int tc = 1;
    // cin >> tc;
    while( tc-- ) {
        solve();
    }
}
 
// Tarun IIITA