#CCBCHBON0000004. Tìm vị trí 0 đầu tiên (First Zero Position)

Tìm vị trí 0 đầu tiên (First Zero Position)

First Zero Position

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

Find the first 1-based position whose value equals zero among nn integers. Print -1 if absent or n=0n=0. Here zero is a searchable data value, not an input terminator.

Input

First nn, then exactly nn integers ai∈[−106,106]a_i\in[-10^6,10^6], separated by whitespace.

Output

Print the position of the first zero, or -1.

Subtasks

  • Subtask 1 (20%): 0≤n≤80\le n\le 8; −106≤ai≤106-10^6\le a_i\le10^6.

  • Subtask 2 (30%): 0≤n≤10000\le n\le 1000; −106≤ai≤106-10^6\le a_i\le10^6.

  • Subtask 3 (50%): 0≤n≤1000000\le n\le 100000; −106≤ai≤106-10^6\le a_i\le10^6.

Examples

Example 1

Input:

5
2 0 0 4 0

Output:

2

Explanation:

Report the first zero, not later occurrences.

Example 2

Input:

0

Output:

-1

Explanation:

Report the first zero, not later occurrences.