print((function (h, l) local n = io.stdin:read("*n") io.stdin:read("*n") local t = io.stdin:read("*n") h, l = t, t for _=2,n do t = io.stdin:read("*n") if t < l then l = t end if h < t then h = t end end return h - l end)(0, 0))