#include <iostream>
#include <algorithm>

int main(int argc, char const *argv[]) {
	int count,min,max,temp;
	min = 1000;
	max = 0;
	std::cin >> count;
	for (size_t i = 0; i < count; i++) {
		std::cin >> temp;
		min = min(min,temp);
		max = max(max,temp);
	}
	std::cout << max-min << '\n';
	return 0;
}
