using System;
using System.Collections.Generic;


class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 最少需要跳跃几次能跳到末尾
     * @param n int整型 数组A的长度
     * @param A int整型一维数组 数组A
     * @return int整型
     */
    public int Jump (int n, List<int> A) {
        // write code here
        if(A == null || A.Count == 0 || A.Count == 1)
        return 0;
        int nRtnMaxPos = 1;
        int nMinStep = 0;
        int nCurPos = 0;
        for(int nIndex = 0; nIndex < A.Count - 1; nIndex++){
            nRtnMaxPos = Math.Max(nIndex + A[nIndex], nRtnMaxPos);
            if(nCurPos == nIndex){
                nCurPos = nRtnMaxPos;
                nMinStep++;
            }
        }
        return nMinStep;
    }
}