It is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts.
There are N houses along TopCoDeer street. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses.
Find the minimum distance to be traveled when AtCoDeer can start and end his travel at any positions.

Constraints

* 1 ≤ N ≤ 100
* 0 ≤ a_i ≤ 1000
* a_i is an integer.

Input

Input is given from Standard Input in the following format:


N
a_1 a_2 ... a_N


Output

Print the minimum distance to be traveled.

Examples

Input

4
2 3 7 9


Output

7


Input

8
3 1 4 1 5 9 2 6


Output

8
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String args[]){
		Scanner cin = new Scanner(System.in);

		int A = cin.nextInt();
		int list[] = new int[A];
		int tmp;
		for(int i=0;i<A;i++){
			list[i] = cin.nextInt();
		}

		Arrays.sort(list);
		tmp = list[0];
		int sum=0;
		for(int j=0;j<A;j++){
			if(tmp==list[j]){
			}else{
				sum+=list[j]-tmp;
				tmp = list[j];
			}
		}

		System.out.println(sum);
	}
}
