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.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;


public class C {

    static StringTokenizer st;
    static BufferedReader br;
    static PrintWriter pw;
    
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = nextInt();
        double[]a = new double[n+1];
        double x = 0;
        for (int i = 1; i <= n; i++) {
            a[i] = nextInt();
            x += a[i];
        }
        x /= n;
        for (int i = 1; i <= n; i++) {
            a[i] -= x;
        }
        double max = 0, min = 0, sum = 0, ans = -1e18;
        for (int i = 1; i <= n; i++) {
            sum += a[i];
            ans = Math.max(ans, Math.abs(sum-min));
            ans = Math.max(ans, Math.abs(sum-max));
            min = Math.min(min, sum);
            max = Math.max(max, sum);
        }
        System.out.println(ans);
        pw.close();
    }

    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    private static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
    private static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
    private static String next() throws IOException {
        while (st==null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }
}