# Frog Jump

hard

1. You are given an array of positive integers in ascending order, which represents the position of stones in the river. 2. A frog is trying to cross a river. It can jump on a stone, but it must not jump into the water. 3. You have to find if the frog can cross the river by landing on the last stone. 4. The frog is on the first stone initially, and from first stone it can jump 1 unit only. 5. The frog can only jump k-1, k, or k+1 units in the forward direction, where k is the frog's last jump.

## Constraints

2 <= n <= 2000 0 <= a[i] < 2^31 a[0] = 0

## Format

### Input

A number N a1 a2.. N numbers

### Output

true/false

## Example

Sample Input

8
0 1 3 5 6 8 12 17

### Sample Output

true