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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author kevindra
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskE solver = new TaskE();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskE {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[200001];
            double avg = 0;
            for (int i = 1; i <= n; i++) {
                a[i] = in.nextInt();
                avg += a[i];
            }
            avg /= n;

            double[] b = new double[200001];
            for (int i = 1; i <= n; i++) b[i] = a[i] - avg;

            // now find the max cont. subseq sum
            double[] minDP = new double[n + 1];
            double[] maxDP = new double[n + 1];

            for (int i = 1; i <= n; i++) {
                if (i == 1) {
                    minDP[i] = b[i];
                    maxDP[i] = b[i];
                } else {
                    minDP[i] = Math.min(minDP[i - 1] + b[i], b[i]);
                    maxDP[i] = Math.max(maxDP[i - 1] + b[i], b[i]);
                }

            }
            double ans = Math.max(Math.abs(minDP[n]), Math.abs(maxDP[n]));
            out.printf("%.15f", ans);
        }

    }
}

