A ticket is a sequence of digits of length . A ticket is called happy if there exists a number (1 \le k \le n) such that [...]. The number in this case is called the happiness boundary.
Your task is to write a program that, given a ticket, determines its smallest happiness boundary, if it exists.
The first line of the input file contains the number (2 \le n \le 10^6) — the length of ticket . The second line contains the digits a_1,\, a_2,\, \ldots,\, a_n (0 \le a_i \le 9), separated by spaces.
If the ticket is happy, output its smallest happiness boundary; otherwise, output **-1**.
Example 1