N = int(input()) A = list(map(int, input().split())) ans = 0 for i in range(N): for j in range(i + 1, N): if i + 1 == A[j]: A[i], A[j] = A[j], A[i] ans += 1 print(ans)