#include<stdio.h>

int main()
{
    int a, N, i, max, min;

    max = 0;
    min = 1000;
    scanf("%d", &N);

    if(i = 0; i < N; i++){
      scanf("%d", &a);
      if(max < a)max = a;
      if(min > a)min = a;
    }

    printf("%d\n", max - min);
    return 0;
}