n=gets.to_i
s=Array.new(n)
m=0
for i in 1..n do
    s[i-1]=gets.to_i
    if i==1 then next
    elsif i==2 then m=s[1]-s[0]
    else
       for x in 0..i-2
         m=[m, s[i-1]-s[x]].max
       end
    end
end
p m