In the event of technical difficulties with Szkopuł, please contact us via email at szkopul@fri.edu.pl.

If you are familiar with IRC chat, the support team is also reachable on PIRC network (`irc.pirc.pl`

) in `#szkopul`

channel. If you are not, just use email.

Please do not ask us things like "how to solve task XYZ?".

Please remember that the support team has to sleep sometimes or go to work in real life.

<Submit a solution> [0/100]**Task statistics**

Number of users: 240

Number of users with 100 points: 215

Average result: 95.3292

# Bytecomputer

### Memory limit: 128 MB

## Input

## Output

## Example

Number of users: 240

Number of users with 100 points: 215

Average result: 95.3292

A sequence of integers from the set is given.
The *bytecomputer* is a device that allows the following operation on the sequence:
incrementing by for any .
There is no limit on the range of integers the bytecomputer can store, i.e.,
each can (in principle) have arbitrarily small or large value.

Program the bytecomputer so that it transforms the input sequence into a non-decreasing sequence (i.e., such that ) with the minimum number of operations.

The first line of the standard input holds a single integer (), the number of elements in the (bytecomputer's) input sequence.

The second line contains integers () that are the successive elements of the (bytecomputer's) input sequence, separated by single spaces.

In tests worth 24% of the total points it holds that , and in tests worth 48% of the total points it holds that .

The first and only line of the standard output should give one integer,
the minimum number of operations the bytecomputer has to perform to make its input sequence non-decreasing,
of the single word `BRAK` (Polish for *none*) if obtaining such a sequence is impossible.

For the input data:

6 -1 1 0 -1 0 1

the correct result is:

3

**Explanation of the example:** with three operations, the bytecomputer can obtain the sequence .

**Sample grading tests:**

`0grade`: , a small test with the answer`BRAK`;`1grade`: , a small test with the answer ;`2grade`: , all the elements in the sequence equal ;`3grade`: , , , ;`4grade`: , , , and .

*Task author: Jacek Tomasiewicz.*