n = int(input()) r = list(map(int, input().split())) current_end = 1 current_max = 1 steps = 0 for i in range(1, n): # i是1-based的城镇编号 if i > current_end: break # 这种情况不会出现,根据题意数据保证可达N current_max = max(current_max, r[i-1]) # 输入中的第i-1个元素对应城镇i的R_i if i == current_end: steps += 1 if current_max >= n: break current_end = current_max print(steps)