Imports System
Module ABC102B
	Sub Main()
		Dim n As Integer
		n = Integer.Parse(Console.ReadLine())
		Dim data(n) As Integer
		Dim inputs() As String = Console.ReadLine().Split()
		For i As Integer = 0 To n-1
			data(i) = Integer.Parse(inputs(i))
		Next
		Dim ans As Integer = -1
		
		For i As Integer = 0 To n-2
			For j As Integer = i+1 To n-1
				ans = Math.Max(ans,Math.Abs(data(i)-data(j)))
			Next
		Next
		Console.WriteLine(ans)
	End Sub
End Module
