require 'tsort'

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

each_node = lambda {|&b| n.times(&b)}
each_child = lambda {|x, &b| b.call((x+a[x])%n)}

p TSort.each_strongly_connected_component(each_node, each_child).map {|scc| (scc.size>1 or a[scc[0]]%n==0) ? scc.size : 0}.reduce(:+)
