#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A;
  int total = 0;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    A.push_back(a);
    total += a;
  }
  float ave = total / N;
  float minNum = 100;
  for (int i = 0; i < N; i++) {
    minNum = min(minNum, A[i] - ave);
  }
  cout << minNum << endl;
}
