# 2013 Петрозаводск, День 6, Август 29, Задачи А - С

# Bytecomputer

A sequence of **n** integers `x`

, _{1}`x`

, ..., _{2}`x`

from the set {_{n}**-1**, **0**, **1**} is given. The bytecomputer is a device that allows the following operation on the sequence: incrementing `x`

by _{i+1}`x`

for any _{i}**1** ≤ **i** < **n**. There is no limit on the range of integers the bytecomputer can store, i.e., each `x`

can (in principle) have arbitrarily small or large value._{i}

Program the bytecomputer so that it transforms the input sequence into a non-decreasing sequence (i.e., such that `x`

≤ _{1}`x`

≤ ...≤ _{2}`x`

) with the minimum number of operations._{n}

#### Input

The first line holds a single integer **n** (**1** ≤ **n** ≤ `10`

), the number of elements in the (bytecomputer's) input sequence. The second line contains ^{6}**n** integers `x`

, _{1}`x`

, ..., _{2}`x`

(_{n}`x`

from {_{i}**-1**, **0**, **1**}) that are the successive elements of the (bytecomputer's) input sequence.

#### Output

Print 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.

#### Explanation

With three operations, the bytecomputer can obtain the sequence **-1**, **-1**, **-1**, **-1**, **0**, **1**.

6 -1 1 0 -1 0 1

3