#CCBCHBON0000012. Số âm đầu tiên (First Negative Value Position)

Số âm đầu tiên (First Negative Value Position)

First Negative Value Position

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

Find the first 1-based index containing a negative value among nn integers, or print -1 if none exists. Use break to stop after the first match.

Input

First nn, followed by exactly nn integers in [−106,106][-10^6,10^6].

Output

The first negative position, 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:

4
0 9 7 -1

Output:

4

Explanation:

Scan left to right; the first negative value determines the reported position.

Example 2

Input:

3
1 2 3

Output:

-1

Explanation:

Scan left to right; the first negative value determines the reported position.