시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
8 초 (추가 시간 없음) 512 MB 0 0 0 0.000%

## 문제

It's time to arrange the books on your bookshelf. There are n books in the shelf and each book has a unique number; you want to sort the books according to the numbers. You know that the quick sort and the merge sort are fast sorting methods, but it is too hard for you to simulate them by hand - they are efficient for computers, but not for humans. Thus, you decided to sort the books by inserting the book with the number i into the i-th position. How many insertions are required to complete this task?

## 입력

The first line of the input is n (1 ≤ n ≤ 20), which is the number of books. The second line contains n integers v1, ... , vn (1 ≤ vi ≤ n), where vi indicates the number of the book at the i-th position before the sorting. All vi's are distinct.

## 출력

Print the minimum number of insertions in a line. If it is impossible for him to complete the sort, print "impossible" (without quotes).

## 예제 입력 1

3
1 2 3


## 예제 출력 1

0


## 예제 입력 2

3
2 1 3


## 예제 출력 2

1


## 예제 입력 3

3
3 2 1


## 예제 출력 3

2


## 예제 입력 4

20
4 14 11 13 17 10 1 12 2 6 16 15 8 7 19 18 3 5 9 20


## 예제 출력 4

14