#include<iostream>
#include<cassert>
#include<climits>
#include<algorithm>
#include<vector>
#include<cstring>
#include<deque>

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)

using namespace std;

#define MAX 100010
int n, a[MAX];
int state[MAX];
bool visited[MAX];

#define FAIL 0
#define SUCC 1


void compute() {
  memset(state,-1,sizeof state);
  rep(i,n) {
    if( state[i] != -1 ) continue;
    memset(visited, false ,sizeof visited);
    deque<int> deq;
    int cur = i;
    deq.push_back(i);
    visited[i] = true;
    while(1) {
      cur = ( cur + a[cur] ) % n;
      deq.push_back(cur);
      if( state[cur] != -1 ) { // fail
	deq.pop_back();
	while( !deq.empty() ) {
	  state[deq.front()] = FAIL;
	  deq.pop_front();
	}
	break;
      }
      if( visited[cur] ) {
	int stop = cur;
	deq.pop_back();
	state[cur] = SUCC;
	while( deq.back() != stop ) {
	  state[deq.back()] = SUCC;
	  deq.pop_back();
	}
	assert( deq.back() == stop );
	deq.pop_back();
	while( !deq.empty() ) {
	  assert( state[deq.back()] == -1 );
	  state[deq.back()] = FAIL;
	  deq.pop_back();
	}
	break;
      } else {
	visited[cur] = true;
      }
    }
  }
  int answer = 0;
  rep(i,n) answer += ( state[i] == SUCC );
  cout << answer << endl;
}

int main() {
  if( 0 ) {
    srand((unsigned int)time(NULL));
    n = 100000;
    cout << n << endl;
    rep(i,n) {
      if( i ) printf(" ");
      //cout << rand() % 1000000000 + 1;
      cout << 1000000000;
    } puts("");
    return 0;
  }
  cin >> n;
  rep(i,n) cin >> a[i];
  compute();
  return 0;
}