// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const long double INF = 1e100;
const ll MOD = 1000000007LL;

const int MAXH = 500;
long double dp[160][MAXH + 10];
signed main() {
    int N; cin >> N;
    vector<int> h(N);
    for(int i=0; i<N; i++) {
        cin >> h[i];
    }

    fill(dp[0], dp[N+1], INF);
    dp[0][1] = 0;
    for(int i=0; i<N; i++) {
        int H = h[i];
        for(int j=1; j<MAXH; j++) {
            if(dp[i][j] == INF) continue;
            for(int k=1; k<MAXH; k++) {
                long double cost = -1;
                // (x_{i-1}, j), (x_{i}, k)
                if(j <= H and k <= H) {
                    long double A = H;
                    long double B = 1.0 * (j + k) / 2;
                    cost = A - B;
                }
                else if(j <= H and k > H) {
                    long double x = 1.0 * (H - j) / (k - j);
                    /*
                    if(j < 10 and k < 10) {
                        fprintf(stderr, "i = %lld, j = %lld, k = %lld, x = %.12Lf\n", i, j, k, x);
                    }
                    */

                    cost = ((H - j) * x + (k - H) * (1 - x)) / 2.0;
                }
                else if(j > H and k <= H) {
                    long double x = 1.0 * (j - H) / (j - k);
                    cost = ((j - H) * x + (H - k) * (1 - x)) / 2.0;
                }
                else {
                    long double h1 = j - H;
                    long double h2 = k - H;
                    cost = (h1 + h2) / 2.0;
                }

                chmin(dp[i+1][k], dp[i][j] + cost);
            }
        }
    }

    /*
    for(int i=0; i<=N; i++) {
        for(int j=0; j<MAXH; j++) {
            if(j >= 10 or dp[i][j] == INF) continue;
            fprintf(stderr, "dp[%lld][%lld] = %.12Lf\n", i, j, dp[i][j]);
        }
    }
    */

    long double res = *min_element(dp[N], dp[N] + MAXH + 5);
    cout << fixed << setprecision(15) << res << endl;
    return 0;
}

