#include <bits/stdc++.h>
using namespace std;
int A[200005], mx[200005], gt[200005];
vector<int> L[200005];
bool use[200005];
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &A[i]);
  for (int i = 1; i < n; i++) L[gcd(i, n)].push_back(i);
  long long int ret = 0;
  for (int i = 0; i < n; i++) {
    if (!L[i].empty()) {
      for (int j = 0; j < i; j++) mx[j] = 0;
      for (int j = 0; j < n; j++) mx[j % i] = max(mx[j % i], A[j]);
      for (int j = 0; j < n; j++) use[j] = A[j] >= mx[j % i];
      memset(gt, 0, sizeof(gt));
      for (int j = 0; j < L[i].size(); j++) gt[L[i][j]]++;
      for (int i = 0; i < n; i++) gt[i + 1] += gt[i];
      int last = 0;
      while (last < n - 1 && use[last]) last++;
      last += n;
      for (int j = n - 1; j >= 0; j--) {
        last = min(last, j + n - 1);
        if (!use[j]) last = j;
        ret += gt[last - j];
      }
    }
  }
  printf("%I64d\n", ret);
  return 0;
}
