n = gets.to_i
sugoroku = gets.split.map(&:to_i)


visit_count_list = Array.new(n) { 0 }
count = 0

n.times do |i|
  visited = Array.new(n) { false }
  start_at = i
  index = i
  c = 0

  while visited[index] == false
    c += 1
    visited[index] = true

    index = (index + sugoroku[index]) % n
  end
  
  count += 1 if start_at == index
end

puts count