You are given a rectangular grid representing a map. Each square in the grid contains an integer, 0 ≤ H ≤ 10000, giving the height (altitude) of the square. A square is 'mountainous' if one or more of the four directly adjacent (north, east, south, or west) squares is at a lower elevation. A set of at least two directly adjacent 'mountainous' squares together form a single 'mountain'.
The height of any 'mountain' is the difference between the the greatest height and the least height of all the squares that comprise the mountain. Your task is to find the highest mountain on a given grid.
The output is a single line that contains one integer that is the height of the highest mountain on the grid or -1 if no mountain exists.