n = gets.to_i
arr = gets.chomp.split.map(&:to_i)
count, checked = 0, []
0.upto(n - 1){|i|
    next if checked[i]
    current, step, h = i, 0, {}
    until checked[current]
        checked[current] = true
        h[current] = step
        step += 1
        current = (current + arr[current]) % n
    end
    count += step - h[current] if h[current]
}
puts count

