using System;
public class Program{
  public static void Main(){
    int line = int.Parse(Console.ReadLine());
    int min = 100;
    int max = 0;
    string[] line2 = Console.ReadLine().Split(' ');
    
    for (int i = 0; i < line; i++) {
      if(int.Parse(line2[i]) < min) min = int.Parse(line2[i]);
      if(max < int.Parse(line2[i])) max = int.Parse(line2[i]);
    }
    Console.WriteLine(max - min);
  }
}