import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		long min = 5000000000l,max = 0,buf;
		for(int i = 0;i < N;i++) {
			buf = Math.abs(scn.nextLong());
			if(buf < min) {
				min = buf;
			}
			if(buf > max) {
				max = buf;
			}
		}
		scn.close();
		System.out.println(max - min);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		long min = 5000000000l,max = 0,buf;
		for(int i = 0;i < N;i++) {
			buf = Math.abs(scn.nextLong());
			if(buf < min) {
				min = buf;
			}
			if(buf > max) {
				max = buf;
			}
		}
		scn.close();
		System.out.println(max - min);
	}
} Main public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		long min = 5000000000l,max = 0,buf;
		for(int i = 0;i < N;i++) {
			buf = Math.abs(scn.nextLong());
			if(buf < min) {
				min = buf;
			}
			if(buf > max) {
				max = buf;
			}
		}
		scn.close();
		System.out.println(max - min);
	} main {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		long min = 5000000000l,max = 0,buf;
		for(int i = 0;i < N;i++) {
			buf = Math.abs(scn.nextLong());
			if(buf < min) {
				min = buf;
			}
			if(buf > max) {
				max = buf;
			}
		}
		scn.close();
		System.out.println(max - min);
	} Scanner scn = new Scanner(System.in); scn new Scanner(System.in) int N = scn.nextInt(); N scn.nextInt() scn.nextInt scn long min = 5000000000l min 5000000000l max = 0 max 0 buf; buf for(int i = 0;i < N;i++) {
			buf = Math.abs(scn.nextLong());
			if(buf < min) {
				min = buf;
			}
			if(buf > max) {
				max = buf;
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			buf = Math.abs(scn.nextLong());
			if(buf < min) {
				min = buf;
			}
			if(buf > max) {
				max = buf;
			}
		} {
			buf = Math.abs(scn.nextLong());
			if(buf < min) {
				min = buf;
			}
			if(buf > max) {
				max = buf;
			}
		} buf = Math.abs(scn.nextLong()) buf Math.abs(scn.nextLong()) Math.abs Math scn.nextLong() scn.nextLong scn if(buf < min) {
				min = buf;
			} buf < min buf min {
				min = buf;
			} min = buf min buf if(buf > max) {
				max = buf;
			} buf > max buf max {
				max = buf;
			} max = buf max buf scn.close() scn.close scn 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 scn = new Scanner(System.in);
		int N = scn.nextInt();
		long min = 5000000000l,max = 0,buf;
		for(int i = 0;i < N;i++) {
			buf = Math.abs(scn.nextLong());
			if(buf < min) {
				min = buf;
			}
			if(buf > max) {
				max = buf;
			}
		}
		scn.close();
		System.out.println(max - min);
	}
} public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		long min = 5000000000l,max = 0,buf;
		for(int i = 0;i < N;i++) {
			buf = Math.abs(scn.nextLong());
			if(buf < min) {
				min = buf;
			}
			if(buf > max) {
				max = buf;
			}
		}
		scn.close();
		System.out.println(max - min);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		long min = 5000000000l,max = 0,buf;
		for(int i = 0;i < N;i++) {
			buf = Math.abs(scn.nextLong());
			if(buf < min) {
				min = buf;
			}
			if(buf > max) {
				max = buf;
			}
		}
		scn.close();
		System.out.println(max - min);
	}
}
