#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000")
using namespace std;
int gcd(int a, int b) {
  if (!a) return b;
  return gcd(b % a, a);
}
int mas[400400];
bool sum[400400];
int ost[400400];
int l[400400];
int canlen[400400];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &mas[i]);
    mas[i + n] = mas[i];
  }
  int n2 = n * 2;
  long long res = 0;
  vector<int> len;
  for (int gg = 1; gg < n; gg++) {
    if (n % gg == 0) {
      for (int i = 0; i <= n2; i++) sum[i] = false;
      for (int i = 0; i <= n2; i++) ost[i] = 0;
      for (int i = 0; i <= n2; i++) canlen[i] = 0;
      for (int i = 0; i <= n2; i++) l[i] = 0;
      int o = 0;
      for (int i = 0; i < n; i++) {
        ost[o] = max(ost[o], mas[i]);
        o++;
        if (o == gg) o = 0;
      }
      o = 0;
      for (int i = 0; i < n; i++) {
        if (mas[i] >= ost[o]) sum[i] = true, sum[i + n] = true;
        o++;
        if (o == gg) o = 0;
      }
      int curlen = 0;
      int sta = 0;
      len.clear();
      for (int i = 0; i < n2; i++) {
        if (sum[i]) {
          if (curlen == 0 && i >= n) break;
          if (curlen == 0) sta = i;
          curlen++;
          if (i + 1 == 2 * n) {
            l[sta] = curlen;
            break;
          }
        } else {
          if (curlen != 0) l[sta] = curlen;
          curlen = 0;
          if (i >= n) break;
        }
      }
      for (int i = 1; i < n2; i++) {
        l[i] = max(l[i], l[i - 1] - 1);
      }
      for (int i = gg; i <= n; i += gg) {
        int g = gcd(i, n);
        if (g == gg) {
          canlen[i] = 1;
        }
      }
      for (int i = 1; i <= n2; i++) canlen[i] += canlen[i - 1];
      for (int i = 0; i < n; i++) {
        if (l[i] != 0) {
          res += canlen[l[i]];
        }
      }
    }
  }
  printf("%lld\n", res);
  return 0;
}
