#include <bits/stdc++.h>
using namespace std;
#define MAX 100000

int a[MAX], x[MAX], y[MAX];
int main(){
	int n;
	scanf("%d", &n);
	for(int i = 0;i < n;i++)scanf("%d", &a[i]);
	
	fill(x, x+MAX, -1);
	fill(y, y+MAX, -1);
	int ans = 0;
	for(int i = 0;i < n;i++){
		int p = i, cnt = 0;
		while(x[p] == -1){
			x[p] = cnt++;
			y[p] = i;
			p = (p+a[p])%n;
		}
		if(y[p] == i)ans += cnt-x[p];
	}
	printf("%d\n", ans);
	return 0;
}
