import java.io.*;
import java.util.*;
public class Main
{
	public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int t=Integer.parseInt(st.nextToken());
      	st = new StringTokenizer(br.readLine());
      	int y[]=new int[t];
      	int p=0;
      	while(st.hasMoreTokens())
        {
          y[p]=Integer.parseInt(st.nextToken());
          p++;
        }
      	Arrays.sort(y);
      	System.out.println(y[t-1]-y[0]);
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main
{
	public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int t=Integer.parseInt(st.nextToken());
      	st = new StringTokenizer(br.readLine());
      	int y[]=new int[t];
      	int p=0;
      	while(st.hasMoreTokens())
        {
          y[p]=Integer.parseInt(st.nextToken());
          p++;
        }
      	Arrays.sort(y);
      	System.out.println(y[t-1]-y[0]);
    }
} Main public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int t=Integer.parseInt(st.nextToken());
      	st = new StringTokenizer(br.readLine());
      	int y[]=new int[t];
      	int p=0;
      	while(st.hasMoreTokens())
        {
          y[p]=Integer.parseInt(st.nextToken());
          p++;
        }
      	Arrays.sort(y);
      	System.out.println(y[t-1]-y[0]);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int t=Integer.parseInt(st.nextToken());
      	st = new StringTokenizer(br.readLine());
      	int y[]=new int[t];
      	int p=0;
      	while(st.hasMoreTokens())
        {
          y[p]=Integer.parseInt(st.nextToken());
          p++;
        }
      	Arrays.sort(y);
      	System.out.println(y[t-1]-y[0]);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st = new StringTokenizer(br.readLine()); st new StringTokenizer(br.readLine()) int t=Integer.parseInt(st.nextToken()); t Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) int y[]=new int[t]; y new int[t] t int p=0; p 0 while(st.hasMoreTokens())
        {
          y[p]=Integer.parseInt(st.nextToken());
          p++;
        } st.hasMoreTokens() st.hasMoreTokens st {
          y[p]=Integer.parseInt(st.nextToken());
          p++;
        } y[p]=Integer.parseInt(st.nextToken()) y[p] y p Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st p++ p Arrays.sort(y) Arrays.sort Arrays y System.out.println(y[t-1]-y[0]) System.out.println System.out System System.out y[t-1]-y[0] y[t-1] y t-1 t 1 y[0] y 0 String[] args args public class Main
{
	public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int t=Integer.parseInt(st.nextToken());
      	st = new StringTokenizer(br.readLine());
      	int y[]=new int[t];
      	int p=0;
      	while(st.hasMoreTokens())
        {
          y[p]=Integer.parseInt(st.nextToken());
          p++;
        }
      	Arrays.sort(y);
      	System.out.println(y[t-1]-y[0]);
    }
} public class Main
{
	public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int t=Integer.parseInt(st.nextToken());
      	st = new StringTokenizer(br.readLine());
      	int y[]=new int[t];
      	int p=0;
      	while(st.hasMoreTokens())
        {
          y[p]=Integer.parseInt(st.nextToken());
          p++;
        }
      	Arrays.sort(y);
      	System.out.println(y[t-1]-y[0]);
    }
} Main
import java.io.*;
import java.util.*;
public class Main
{
	public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int t=Integer.parseInt(st.nextToken());
      	st = new StringTokenizer(br.readLine());
      	int y[]=new int[t];
      	int p=0;
      	while(st.hasMoreTokens())
        {
          y[p]=Integer.parseInt(st.nextToken());
          p++;
        }
      	Arrays.sort(y);
      	System.out.println(y[t-1]-y[0]);
    }
}