from collections import * from itertools import * from functools import * from heapq import * import sys,math input = sys.stdin.readline N = int(input()) P = list(map(int,input().split())) P = [i-1 for i in P] ans = 0 for i in range(N): if P[i]!=i: for j in range(i+1,N): if P[j]==i: P[i],P[j] = P[j],P[i] break ans += 1 print(ans)