#include <bits/stdc++.h>
using namespace std;
int n;
int a[400000];
int gg[400001];
int inc(int v) {
  if (v + 1 == n) return 0;
  return v + 1;
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool u[400001];
int c[400001];
int main(void) {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    gg[i] = gcd(n, i);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  long long res = 0;
  for (int g = 1; g < n; g++) {
    if (n % g != 0) continue;
    memset(u, false, sizeof(u));
    memset(c, 0, sizeof(c));
    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 flag = false;
    for (int l = 0; l < n;) {
      int r = inc(l);
      if (u[l]) {
        l++;
        continue;
      }
      flag = 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 (!flag) {
      for (int i = 1; i <= n; i++) {
        c[i] += n;
      }
    }
    for (int i = 1; i <= n; i++) {
      if (gg[i] == g) res += c[i];
    }
  }
  cout << res << endl;
  return 0;
}
