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

void main()
{
	auto n = readln.strip.to!( int );
	auto as = readln.split.to!( int[] );
	writeln( solve( as ) );
}

auto solve( in int[] as )
{
	auto mi = as.reduce!( min );
	auto ma = as.reduce!( max );
	return ma - mi;
}
