#include <bits/stdc++.h>
using namespace std;
const int MN = 200200;
int n;
int a[MN];
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long full(int c, int d) {
  long long re = 0;
  for (int dd = d; dd <= c; dd += d) {
    if (gcd(dd, n) != d) continue;
    re += n;
  }
  return re;
}
long long cou(int c, int d) {
  long long re = 0;
  for (int dd = d; dd <= c; dd += d) {
    if (gcd(dd, n) != d) continue;
    re += (c - dd + 1);
  }
  return re;
}
int md[MN];
bool ok[MN];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
  }
  long long sm = 0;
  for (int l = 1; l < n; l++) {
    if (n % l != 0) continue;
    fill_n(md, n, 0);
    int t = n / l;
    for (int j = 0; j < t; j++) {
      for (int k = 0; k < l; k++) {
        md[k] = max(md[k], a[j * l + k]);
      }
    }
    for (int j = 0; j < t; j++) {
      for (int k = 0; k < l; k++) {
        ok[j * l + k] = (a[j * l + k] == md[k]);
      }
    }
    int st = -1;
    for (int j = 0; j < n; j++) {
      if (!ok[j]) {
        st = j;
        break;
      }
    }
    if (st == -1) {
      sm += full(n, l);
      continue;
    }
    int ba = 1;
    for (int j = 1; j < n; j++) {
      int k = st + j;
      if (n <= k) k -= n;
      if (!ok[k]) {
        sm += cou(j - ba, l);
        ba = j + 1;
      }
    }
    sm += cou(n - ba, l);
  }
  cout << sm << endl;
  return 0;
}
