#include <bits/stdc++.h>
using namespace std;
int a[200010], b[200010], c[200010], d[200010], ma[200010];
vector<int> e[200010];
int read() {
  char ch;
  for (ch = getchar(); (ch < '0' || ch > '9') && ch != '-';) ch = getchar();
  int d = 0, t = 1;
  if (ch == '-') {
    t = -1;
    ch = getchar();
  }
  for (; ch >= '0' && ch <= '9'; ch = getchar()) d = d * 10 + ch - 48;
  return d * t;
}
int gcd(int x, int y) {
  while (y) {
    int r = x % y;
    x = y;
    y = r;
  }
  return x;
}
int main() {
  int n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= n; i++) e[gcd(i, n)].push_back(i);
  long long ans = 0;
  for (int i = 1; i < n; i++)
    if (n % i == 0) {
      for (int j = 0; j < i; j++) ma[j] = 0;
      for (int j = 1; j <= n; j++) ma[j % i] = max(ma[j % i], a[j]);
      int cnt = 0;
      for (int j = 1; j <= n; j++)
        if (ma[j % i] == a[j]) b[++cnt] = j;
      int m = 0;
      if (cnt == n) {
        for (vector<int>::iterator p = e[i].begin(); p != e[i].end(); p++)
          ans = ans + n;
      } else {
        int l = 0;
        for (int j = 1; j < cnt; j++)
          if (b[j] + 1 != b[j + 1]) d[++l] = j;
        if (b[1] != 1 || b[cnt] != n) d[++l] = cnt;
        m = l;
        for (int j = 1; j < m; j++) c[j] = d[j + 1] - d[j];
        c[m] = d[1] + cnt - d[m];
        sort(c + 1, c + m + 1);
        int k = 1;
        for (vector<int>::iterator p = e[i].begin(); p != e[i].end(); p++) {
          while (k <= m && (*p) > c[k]) k++;
          for (int j = k; j <= m; j++) ans = ans + c[j] - (*p) + 1;
        }
      }
    }
  cout << ans << endl;
  return 0;
}
