x = $stdin.gets.to_i
a = gets.chomp.split(" ").map(&:to_i)
b = Array.new(a.length,1)
x = 0
(a.length+ 1).times do |i|
  if a[i-1] == i
    b[i-1] = 0
  end
end
p b
b.length.times do |k|
  if b[k-1] == 0
    x = x + 1
    b[k] = 1
  end
end
p x