import Data.List
import Data.Ord
import Data.Char
import Data.Ratio
import Data.Maybe

main = do
  n <- readLn :: IO Int
  as <- map (read::String->Int) . words <$> getLine
  print $ maximum [abs (x-y)|(i,x)<-zip [1..] as, (j,y)<-zip [1..] as, i<j]