from collections import deque N = int(input()) R = list(map(int, input().split())) edge = [-1 for _ in range(N)] for i in range(N - 1): for j in range(R[i] - 1, i, -1): if edge[j] == -1: edge[j] = i else: break now = N - 1 cnt = 0 while now != 0: cnt += 1 now = edge[now] print(cnt)