#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, a[N], f[N];
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
long long calc(int d, int len) {
  long long ans = 0;
  for (int s = d; s <= len; s += d) {
    if (gcd(s, n) != d) continue;
    if (len == n)
      ans += len;
    else
      ans += len + 1 - s;
  }
  return ans;
}
long long calc(int d) {
  memset(f, 0, sizeof(f));
  for (int i = 0; i < d; i++) {
    int t = 0;
    for (int j = 0; j < n / d; j++) t = max(t, a[j * d + i]);
    for (int j = 0; j < n / d; j++) f[j * d + i] = (t == a[j * d + i]);
  }
  int p = 0;
  long long ans = 0;
  while ((p < n) && f[p]) p++;
  if (p == n) return calc(d, n);
  for (int i = (p + 1) % n; i != p; i = (i + 1) % n) {
    int len = 0;
    while (f[(i + len) % n]) len++;
    if (len > 0) {
      ans += calc(d, len);
      i = (i + len - 1) % n;
    }
  }
  return ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  long long ans = 0;
  for (int x = 1; x * x <= n; x++) {
    if (n % x != 0) continue;
    ans += calc(x);
    if ((x != 1) && (x * x != n)) ans += calc(n / x);
  }
  if (n == 1) ans = 0;
  printf("%I64d\n", ans);
}
