import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String args[]) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = br.readLine(); int n = Integer.parseInt(line); line = br.readLine(); // int k = Integer.parseInt(line); int min = 1000; int max = 0; for (int i = 0; i < n; i++) { int t = Integer.parseInt(br.readLine()); if (min > t) { min = t; } if (max < t) { max = t; } } System.out.println(max - min); } }