import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt(), a, max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++)
		{
			a = scan.nextInt();
			max = a > max ? a : max;
			min = a < min ? a : min;
		}
		scan.close();
		System.out.println(max - min);
		
	}
} import java.util.Scanner; Scanner java.util public class Main
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt(), a, max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++)
		{
			a = scan.nextInt();
			max = a > max ? a : max;
			min = a < min ? a : min;
		}
		scan.close();
		System.out.println(max - min);
		
	}
} Main public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt(), a, max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++)
		{
			a = scan.nextInt();
			max = a > max ? a : max;
			min = a < min ? a : min;
		}
		scan.close();
		System.out.println(max - min);
		
	} main {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt(), a, max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++)
		{
			a = scan.nextInt();
			max = a > max ? a : max;
			min = a < min ? a : min;
		}
		scan.close();
		System.out.println(max - min);
		
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt() n scan.nextInt() scan.nextInt scan a a max = Integer.MIN_VALUE max Integer.MIN_VALUE Integer Integer.MIN_VALUE min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 0; i < n; i++)
		{
			a = scan.nextInt();
			max = a > max ? a : max;
			min = a < min ? a : min;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			a = scan.nextInt();
			max = a > max ? a : max;
			min = a < min ? a : min;
		} {
			a = scan.nextInt();
			max = a > max ? a : max;
			min = a < min ? a : min;
		} a = scan.nextInt() a scan.nextInt() scan.nextInt scan max = a > max ? a : max max a > max ? a : max a > max a max a max min = a < min ? a : min min a < min ? a : min a < min a min a min scan.close() scan.close scan System.out.println(max - min) System.out.println System.out System System.out max - min max min String[] args args public class Main
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt(), a, max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++)
		{
			a = scan.nextInt();
			max = a > max ? a : max;
			min = a < min ? a : min;
		}
		scan.close();
		System.out.println(max - min);
		
	}
} public class Main
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt(), a, max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++)
		{
			a = scan.nextInt();
			max = a > max ? a : max;
			min = a < min ? a : min;
		}
		scan.close();
		System.out.println(max - min);
		
	}
} Main
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt(), a, max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++)
		{
			a = scan.nextInt();
			max = a > max ? a : max;
			min = a < min ? a : min;
		}
		scan.close();
		System.out.println(max - min);
		
	}
}