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