10
-405 -230 252 -393 -390 -259 97 163 81 -129
 3
10000 -10000 10000
 1
-10000
 20
-16 -23 29 44 -40 -50 -41 34 -38 30 -12 28 -44 -49 15 50 -28 38 -2 0

702.333333333333712
 10000.000000000016371
 0.000000000000000
 113.875000000000043

import java.io.PrintWriter;
import java.util.*;
import java.util.stream.IntStream;

import static java.lang.Math.*;

import static java.util.stream.IntStream.range;

public class Sub {

    public static void main(String[] args) throws Exception {
        new Sub().doit();
    }

    double res(int[] ints) {
        double left = ints[0];
        double right = ints[ints.length - 1];
        for (int iter = 0; iter < 200; iter++) {

            double newLeft = (2 * left + right) / 3.;
            double newRight = (left + 2 * right) / 3.;

            double ap = 0.;
            double an = 0.;
            double bp = 0.;
            double bn = 0.;

            double ma = 0;
            double mb = 0;

            for (int i = 0; i < ints.length; i++) {
                double a = ints[i] - newLeft;
                double b = ints[i] - newRight;

                if (a > 0) {
                    ap += a;
                    ma = max(ma, ap);
                    an = max(0, an - a);
                } else {
                    an -= a;
                    ma = max(ma, an);
                    ap = max(0, ap + a);
                }

                if (b > 0) {
                    bp += b;
                    mb = max(mb, bp);
                    bn = max(0, bn - b);
                } else {
                    bn -= b;
                    mb = max(mb, bn);
                    bp = max(0, bp + b);
                }
            }

            if (ma > mb) // target in the right 2/3
                left = newLeft;
            else // target in the left 2/3
                right = newRight;
        }


        double ap = 0.;
        double an = 0.;
        double ma = 0.;
        for (int i = 0; i < ints.length; i++) {
            double a = ints[i] - left;

            if (a > 0) {
                ap += a;
                ma = max(ma, ap);
                an = max(0, an - a);
            } else {
                an -= a;
                ma = max(ma, an);
                ap = max(0, ap + a);
            }
        }
        return ma;
    }
    public void doit() throws Exception {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = sc.nextInt();

        int[] ints = new int[n];

        int mx = ints[0];
        int mn = ints[0];

        for (int i = 0; i < n; i++) {
            ints[i] = sc.nextInt();
            mx = max(ints[i], mx);
            mn = min(ints[i], mn);
        }

        // center at 0


        int[] cent = new int[n];
        for (int i = 0; i < ints.length; i++) {
            cent[i] = ints[i] - mn;
        }
        double ret = res(cent);

        for (int i = 0; i < ints.length; i++) {
            ints[i] = ints[i] - mx;
        }
        ret = min(ret, res(ints));

        System.out.println(ret);







        sc.close();
        out.close();
    }

}
