#CCBCHBAHAI0000061. Vị trí số khác 0 đầu tiên và cuối cùng (First and Last Nonzero Positions)

Vị trí số khác 0 đầu tiên và cuối cùng (First and Last Nonzero Positions)

First and Last Nonzero Positions (Vị trí số khác 0 đầu tiên và cuối cùng)

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem

Given a0,…,an−1a_0,\ldots,a_{n-1}, define

I={i∣0≤i<n, ai≠0}.I=\{i\mid0\le i<n,\ a_i\ne0\}.

If II is nonempty, print L=min⁡IL=\min I and R=max⁡IR=\max I. If II is empty, print -1 -1. Indices are 0-based.

Input

The first line contains nn. The second line contains nn integers aia_i.

Output

Print L R as defined.

Subtask

Subtask 1 (20 points): 1≤n≤101\le n\le10, ∣ai∣≤103|a_i|\le10^3.

Subtask 2 (30 points): 1≤n≤50001\le n\le5000, ∣ai∣≤106|a_i|\le10^6.

Subtask 3 (50 points): 1≤n≤2⋅1051\le n\le2\cdot10^5, ∣ai∣≤109|a_i|\le10^9.

Example

Input

7
0 0 5 0 -2 0 0

Output

2 4

Explanation

The sample follows the definitions and rules above.