Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/eng-uzun-sakrash

Longest jump

Easy 1000 ms 64 MB 29%
Share

In the long jump, an athlete made $n$ attempts. The result of each attempt is given in centimetres; a foul attempt is marked $-1$ and does not count. Find the athlete's longest counted jump. If all attempts are fouls, print $0$.

Jump lengths as bars; fouls are crossed out, the longest counted jump is highlighted

Input

The first line contains a positive integer $n$.
The second line contains $n$ integers — the results.

Output

One integer — the longest jump or $0$.

Note

$1 \le n \le 100$
each result is $-1$ or from $1$ to $1000$

Examples

Input #1
6
745 -1 802 -1 790 -1
Output #1
802
Input #2
3
-1 -1 -1
Output #2
0

Sign in to submit a solution

Signing up is free and takes a minute.