-- yukicoder My Practice -- author: Leonardone @ NEETSDKASU n = io.read() gi = io.read():gmatch('%d+') mx = 0 ans = 0 for i = 1, n do v = tonumber(gi()) if v > mx then mx = v elseif v > ans then ans = v end end print(ans)