#!/usr/bin/env python3 def main(): N = int(input()) R = list(map(lambda i: int(i) - 1, input().split())) + [N - 1] now = 0 next = R[0] ans = 0 while now < N - 1: checked = now now = next temp = 0 for i in range(checked + 1, R[next] + 1): if R[i] >= temp: next = i ans += 1 print(ans) if __name__ == '__main__': main()