#include <bits/stdc++.h>

using namespace std;

int N;
int DataInfo[100000];
int User[100000];

int solve() {
	int curPos, tmp, sum;

	sum = 0;
	for (int i = 0; i < N; ++i) {
		if (User[i] != 0) {
			continue;
		}
		curPos = i;
		while (User[curPos] == 0) {
			User[curPos] = i + 1;
			curPos = (curPos + DataInfo[curPos]) % N;
		}
		if (User[curPos] != i + 1) {
			continue;
		}
		tmp = curPos;
		do {
			++sum;
			curPos = (curPos + DataInfo[curPos]) % N;
		} while (curPos != tmp);
	}

	return sum;
}

int main() {
	
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> DataInfo[i];
	}
	cout << solve() << endl;

	return 0;
}
