시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 512 MB 7 4 4 57.143%

문제

Zenyk bought a string of length n, which contains only 0 and 1 characters. He wants to present it to Marichka, however he knows that she likes only palindromes (strings which read the same backward as forward) and she will be satisfied with just such a gift.

In one hour, Zenyk can change the string by moving any one of its characters to the end of the string. What is the minimum number of hours needed for Zenyk to prepare a gift for Marichka?

입력

The first line contains one integer n (1 ≤ n ≤ 300). The second line contains a string of length n containing only 0 and 1 characters.

출력

If Zenyk succeeds in preparing a gift then print one integer — the minimum number of hours.

If he can’t do that print “-1” (without quotes).

예제 입력 1

7
1101001

예제 출력 1

1

예제 입력 2

4
1001

예제 출력 2

0

예제 입력 3

12
110100010011

예제 출력 3

3