Problem Description

Read n heights. Water trapped between bars should be calculated and printed.

Input Format

First line n. Second line n heights.

Output Format

One integer water.

Sample Test Case

Input:
12 0 1 0 2 1 0 1 3 2 1 2 1
Output:
6

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next