#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


double dp[200][400];
int main(){
    int n;
    cin>>n;
    int h[n+1];
    rep(i,n)cin>>h[i];
    rep(i,200)rep(j,400)dp[i][j]=inf;
    dp[0][1]=0;
    rep(i,n){
        REP(j,1,400)REP(k,1,400){
            if((j<h[i])^(k<h[i])){
                double x=abs(j-h[i]),y=abs(k-h[i]);
                dp[i+1][k]=min(dp[i+1][k],dp[i][j]+(double)(x*x+y*y)/2.0/(x+y));
            }
            else{
                double x=abs(j-h[i]),y=abs(k-h[i]);
                dp[i+1][k]=min(dp[i+1][k],dp[i][j]+(double)(x+y)/2.0);
            }
        }
    }
    double ans=longinf;
    rep(i,400)ans=min(ans,dp[n][i]);
    cout<<fixed<<setprecision(9)<<ans<<endl;
    return 0;
}
