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

#include <bits/stdc++.h>
int floor(int a, int b) { return a / b; }
double maximum(double a, double b) { return a > b ? a : b; }
double minimum(double a, double b) { return a < b ? a : b; }
double sum(double a[], int size) {
  double max_so_far = 0, max_ending_here = 0;
  int i;
  for (i = 0; i < size; i++) {
    max_ending_here = max_ending_here + a[i];
    if (max_ending_here < 0) max_ending_here = 0;
    if (max_so_far < max_ending_here) max_so_far = max_ending_here;
  }
  return max_so_far;
}
int main() {
  int n;
  scanf("%d", &n);
  int arr[n], total = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
    total += arr[i];
  }
  double avg = total * 1.00 / (n * 1.00);
  double arr1[n];
  for (int i = 0; i < n; i++) {
    arr1[i] = arr[i] - avg;
  }
  printf("%.6f\n", sum(arr1, n));
  return 0;
}
