#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, gc[N], mx[N], a[N], b[N * 2], c[N];
long long ans = 0;
int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i < n; i++) gc[i] = gcd(i, n);
  for (int g = 1; g < n; g++) {
    if (n % g) continue;
    for (int i = 1; i < n; i++) c[i] = c[i - 1] + (gc[i] == g);
    for (int i = 0; i < g; i++) mx[i] = -1;
    for (int i = 1; i <= n; i++) mx[i % g] = max(mx[i % g], a[i]);
    for (int i = 1; i <= n; i++) {
      if (a[i] == mx[i % g])
        b[i] = 1;
      else
        b[i] = 0;
      b[i + n] = b[i];
    }
    for (int i = n * 2 - 1; i >= 1; i--)
      if (b[i]) b[i] += b[i + 1];
    for (int i = 1; i <= n; i++) ans += c[min(n - 1, b[i])];
  }
  printf("%I64d", ans);
  return 0;
}
