#include <bits/stdc++.h>
const int N = 200000;
inline int gcd(int a, int b) {
  while (b) {
    int c = a % b;
    a = b;
    b = c;
  }
  return a;
}
int n;
int a[N], b[N], g[N];
long long ans;
inline int regular(int x) {
  if (x >= n) return x - n;
  return x;
}
long long cal(int t) {
  static bool c[N];
  for (int i = 0; i < n; i++) c[i] = false;
  for (int i = 0; i < t; i++) {
    int maxv = 0;
    for (int j = i; j < n; j += t)
      if (maxv < a[j]) maxv = a[j];
    for (int j = i; j < n; j += t)
      if (maxv == a[j])
        c[j] = true;
      else
        c[j] = false;
  }
  static int d[N];
  d[0] = 0;
  for (int i = 1; i < n; i++) {
    if (g[i] == t)
      d[i] = d[i - 1] + 1;
    else
      d[i] = d[i - 1];
  }
  long long ans = 0;
  for (int i = 0, j = 0; i < n; i++, j--) {
    if (j < 0) j = 0;
    while (j < n - 1 && c[regular(i + j)] == true) j++;
    ans += d[j];
  }
  return ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 1; i < n; i++) b[gcd(i, n)]++;
  for (int i = 1; i < n; i++) g[i] = gcd(i, n);
  for (int i = 1; i < n; i++)
    if (b[i] != 0) {
      ans += cal(i);
    }
  printf("%I64d\n", ans);
  return 0;
}
