#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 * 1000 + 10;
int a[MAXN], n, c[MAXN], gg[MAXN];
bool u[MAXN];
int inc(int v) { return (v + 1 == n) ? 0 : (v + 1); }
int GCD(int a, int b) { return b == 0 ? a : GCD(b, a % b); }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) gg[i] = GCD(i, n);
  long long res = 0;
  for (int g = 1; g < n; g++) {
    if (n % g != 0) continue;
    for (int i = 0; i < n; i++) u[i] = false, c[i] = 0;
    for (int i = 0; i < g; i++) {
      int mx = -1;
      for (int j = i; j < n; j += g) mx = max(mx, a[j]);
      for (int j = i; j < n; j += g)
        if (a[j] == mx) u[j] = true;
    }
    bool any = false;
    for (int l = 0; l < n;) {
      int r = inc(l);
      if (u[l]) {
        l++;
        continue;
      }
      any = true;
      int len = 0;
      while (u[r]) len++, r = inc(r);
      for (int i = 1; i <= len; i++) c[i] += len - i + 1;
      if (r <= l) break;
      l = r;
    }
    if (!any)
      for (int i = 1; i <= n; i++) c[i] += n;
    for (int i = 1; i <= n; i++)
      if (gg[i] == g) res += c[i];
  }
  printf("%lld\n", res);
  return 0;
}
