#C777. Optimal Jump Height for Obstacles
Optimal Jump Height for Obstacles
Optimal Jump Height for Obstacles
In this problem, you are given a sequence of obstacle heights. A robot has to jump over these obstacles. The minimum jump height required to clear all obstacles is determined by the maximum obstacle height plus one.
If there are no obstacles, the robot does not need to jump at all, and the answer is 0.
Mathematically, if the obstacles are \( h_1, h_2, \ldots, h_n \), then the minimum jump height is \( \max(h_1, h_2, \ldots, h_n) + 1 \) for \( n > 0 \).
inputFormat
The input is read from standard input. The first line contains an integer \( n \) representing the number of obstacles. The second line contains \( n \) space-separated integers representing the heights of each obstacle. If \( n = 0 \), then no obstacles are provided.
outputFormat
Output the minimum jump height required for the robot to clear all obstacles. The result should be printed to standard output.
## sample0
0
</p>