#include <bits/stdc++.h>
using namespace std;
template<typename T = int> vector<T> create(size_t n){ return vector<T>(n); }
template<typename T, typename... Args> auto create(size_t n, Args... args){ return vector<decltype(create<T>(args...))>(n, create<T>(args...)); }
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	auto get = [&](long double p){
		long double sum = 0;
		for(int i = 0; i < n; i++){
			sum += p + a[i] - min((long double) a[i], 2 * p);
		}
		return sum;
	};
	long double lo = 0, hi = 1e9;
	for(int r = 0; r < 200; r++){
		long double f1 = lo + (hi - lo) / 3, f2 = lo + 2 * (hi - lo) / 3;
		if(get(f1) < get(f2)) hi = f2;
		else lo = f1;
	}
	cout << fixed << setprecision(12) << get(lo)/n << '\n';
	return 0;
}

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

int gcd(int, int);

int main(void){
    //init val
    int n, kosuu = 0;
    cin >> n;
    int *a;int *b;int *c;
    a = new int[n];
    b = new int[n];
    c = new int[1000];
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    for (int i = 0; i < n; i++){
        cin >> b[i];
    }
    for (int i = 0; i < 1000; i++){
        c[i] = 0;
    }
    //main code
    for (int i = 0; i < n; i++){
        for (int j = a[i] - 1; j < b[i]; j++){
            c[j]++;
            
        }
    }
    for (int i = 0; i < 1000; i++){
        if (c[i] == n){
            kosuu++;
        }
    }
    cout << kosuu << endl;
    return 0;
}

int gcd(int x, int y){
    if (x%y == 0){
        return y;
    }else{
        return gcd(y, x%y);
    }
}