#include<bits/stdc++.h>

using namespace std;
#define INF (1<<28)
#define DEKAI 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define int long long
pair<int,int> check[100001];
int a[100001];
int ans,n;

signed main(){
  cin>>n;
  lp(i,n) cin>>a[i];
  int logs=1;
  lp(z,n){
    if(check[z].second!=0) continue;
    int now=z;
    int cnt=1;
    while(1){
      if(check[now].second!=logs&&check[now].second!=0) break;
      if(check[now].second==logs){
        ans+=cnt-check[now].first;
        break;
      }
      check[now]={cnt,logs};
      now=(now+a[now])%n;
      cnt++;
    }
    logs++;
  }
  cout<<ans<<endl;
  return 0;
}
