import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class No21{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); String k = br.readLine(); int[] num = new int[n]; for(int i=0; i < n; i++) num[i] = Integer.parseInt(br.readLine()); Arrays.sort(num); System.out.println(num[n-1] - num[0]); } }