#include <bits/stdc++.h>
using namespace std;
int n, i, j, k, a[500010], vis[500010], flag[500010], t, tmp, len, typ,
    g[500010];
long long ans;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n; i++) g[i] = gcd(i, n);
  for (i = 1; i < n; i++)
    if (n % i == 0) {
      for (j = 0; j < 2 * n; j++) {
        vis[j] = 0;
        flag[j] = 0;
      }
      for (j = 0; j < n; j++)
        if (vis[j] == 0) {
          t = j;
          tmp = 0;
          while (vis[t] == 0) {
            vis[t] = 1;
            if (a[t] > tmp) tmp = a[t];
            t = (t + i) % n;
          }
          t = j;
          while (vis[t] != 2) {
            vis[t] = 2;
            if (a[t] == tmp) {
              flag[t] = 1;
              flag[n + t] = 1;
            }
            t = (t + i) % n;
          }
        }
      for (j = 0; j < 2 * n; j++)
        if (flag[j] == 0) break;
      if (j != 2 * n) {
        len = 0;
        typ = 0;
        for (k = j; k < j + n; k++) {
          if (flag[k]) {
            len++;
            if (g[len] == i) typ++;
          } else {
            typ = 0;
            len = 0;
          }
          ans = ans + typ;
        }
      } else {
        for (k = 1; k <= n; k++)
          if (g[k] == i) ans = ans + n;
      }
    }
  printf("%I64d\n", ans);
}
