526. Gem Hunt

0

Medium

Alice and Bob are engaged in a game. They have a sequence of N blocks, with Alice placing a gem on the last block. Bob starts on the first block and can only move forward. Each block has a number indicating the maximum number of steps Bob can take from that position. Your task is to determine if Bob can reach the last block. Output "true" if he can, and "false" if he cannot.

Input Format

The first line contains a single integer N, representing the size of the array. The next line contains N integers, representing the maximum jump length at each index i, where 0<=i<=N-1.

Output Format

Print "true" or "false" to indicate whether Bob can reach the gem or not.

Example

Input

5 2 3 1 1 4

Output

true

Constraints

1<= Arr.size() <= 105
0<= Arr[i]<= 105
Loading...

View Submissions

Console