import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

// https://abc102.contest.atcoder.jp/tasks/abc102_b
public class Main
{

    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        List<Integer> a = new ArrayList<>();
        for (int i=0; i<n; i++) {
            a.add(in.nextInt());
        }
        int max = Collections.max(a);
        int min = Collections.min(a);
        System.out.println(max - min);
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main
{

    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        List<Integer> a = new ArrayList<>();
        for (int i=0; i<n; i++) {
            a.add(in.nextInt());
        }
        int max = Collections.max(a);
        int min = Collections.min(a);
        System.out.println(max - min);
    }
} Main public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        List<Integer> a = new ArrayList<>();
        for (int i=0; i<n; i++) {
            a.add(in.nextInt());
        }
        int max = Collections.max(a);
        int min = Collections.min(a);
        System.out.println(max - min);
    } main {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        List<Integer> a = new ArrayList<>();
        for (int i=0; i<n; i++) {
            a.add(in.nextInt());
        }
        int max = Collections.max(a);
        int min = Collections.min(a);
        System.out.println(max - min);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in List<Integer> a = new ArrayList<>(); a new ArrayList<>() for (int i=0; i<n; i++) {
            a.add(in.nextInt());
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            a.add(in.nextInt());
        } {
            a.add(in.nextInt());
        } a.add(in.nextInt()) a.add a in.nextInt() in.nextInt in int max = Collections.max(a); max Collections.max(a) Collections.max Collections a int min = Collections.min(a); min Collections.min(a) Collections.min Collections a 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 in = new Scanner(System.in);
        int n = in.nextInt();
        List<Integer> a = new ArrayList<>();
        for (int i=0; i<n; i++) {
            a.add(in.nextInt());
        }
        int max = Collections.max(a);
        int min = Collections.min(a);
        System.out.println(max - min);
    }
} public class Main
{

    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        List<Integer> a = new ArrayList<>();
        for (int i=0; i<n; i++) {
            a.add(in.nextInt());
        }
        int max = Collections.max(a);
        int min = Collections.min(a);
        System.out.println(max - min);
    }
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

// https://abc102.contest.atcoder.jp/tasks/abc102_b
public class Main
{

    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        List<Integer> a = new ArrayList<>();
        for (int i=0; i<n; i++) {
            a.add(in.nextInt());
        }
        int max = Collections.max(a);
        int min = Collections.min(a);
        System.out.println(max - min);
    }
}
