#164. 二分查找小的 true 位置

二分查找小的 true 位置

Description

在一个左端是连续的false(用0表示),右端是连续的true(用1表示)的一维数组中,找到位置最小的true的位置。

Format

Input

第1行:1个整数N,表示数组的长度

第2行:N个用空格分开的数,true用1表示, false用0表示。

Output

第1行:1个整数,表示最小的值为 true 的位置

Samples

10
0 0 0 0 0 0 1 1 1 1
7

Limitation

1s, 1024KiB for each test case. 2N1002 \le N \le 100