import std.string;
import std.range;
import std.conv;
import std.stdio;
import std.algorithm;

void main()
{
	auto N = readln.chomp.to!int;
	auto A = readln.split.to!(int[]);
	auto m = A.reduce!max;
	auto l = A.reduce!min;
    writeln(m-l);
}