#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)

ll read(){
	ll x;
	scanf("%lld",&x);
	return x;
}

void print(ll x){
	printf("%lld\n",x);
}

using vi=vector<int>;
#define PB push_back
#define ALL(x) x.begin(),x.end()

template<class T>
void chmin(T&a,T b){
	if(a>b)a=b;
}

const int Nmax=160;
const int Vmax=334;
double dp[Nmax][Vmax];

signed main() {
	int n=read();
	vi h(n);
	REP(i,n)
		h[i]=read();
	REP(i,Vmax){
		dp[0][i]=TEN(9);
	}
	const auto Area=[&](int a,int b){
		if(a*b>=0){
			a=abs(a);b=abs(b);
			return double(a+b)/2;
		}else{
			a=abs(a);b=abs(b);
			return double(a*a+b*b)/(a+b)/2;
		}
	};
	dp[0][1]=0;
	REP(i,n){
		FOR(j,1,Vmax){
			dp[i+1][j]=TEN(9);
			FOR(k,1,Vmax)
				chmin(dp[i+1][j],dp[i][k]+Area(k-h[i],j-h[i]));
		}
	}
	double ans=*min_element(dp[n]+1,dp[n]+Vmax);
	cout<<fixed<<setprecision(20)<<ans<<endl;
    return 0;
}

