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

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

while true
  while visit_count_list[index] < 2
    visit_count_list[index] += 1
  
    index = (index + sugoroku[index]) % n
  end
  
  index = visit_count_list.index(0)
  break if index.nil?
end

puts visit_count_list.count { |i| i > 1 }