#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;

using namespace std;

struct Info{
	int type;
	bool first_check;
};

int main(){

	int N,current,base;
	scanf("%d",&N);

	int* table = new int[N];
	Info* info = (Info*)malloc(sizeof(Info)*(N));

	for(int i = 0; i< N; i++){
		scanf("%d",&table[i]);
		info[i].type = 0;
		info[i].first_check = false;
	}

	for(int i = 0; i < N; i++){
		if(info[i].type == 0){
			info[i].first_check = true;
			current = (i + table[i])%N;
			while(info[current].first_check == false && info[current].type == 0){
				info[current].first_check = true;
				current = (current + table[current])%N;
			}
			if(current == i){
				info[i].type = 1;
				current = (i + table[i])%N;
				while(current != i){
					info[current].type = 1;
					current = (current + table[current])%N;
				}
			}else{
				if(info[current].type != 0){
					 info[i].type = -1;
					current = (i + table[i])%N;
					while(info[current].type == 0){
						info[current].type = -1;
						current = (current + table[current])%N;
					}
				}else{ //current.type == 0
					info[current].type = 1;
					base = current;
					current = (current + table[current])%N;
					while(current != base){
						info[current].type = 1;
						current = (current + table[current])%N;
					}

					info[i].type = -1;
					current = (i + table[i])%N;
					while(info[current].type == 0){
						info[current].type = -1;
						current = (current + table[current])%N;
					}
				}
			}
		}
	}

	int count = 0;
	for(int i = 0; i < N; i++){
		if(info[i].type == 1)count++;
	}

	printf("%d\n",count);

    return 0;
}