#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool RD(T &ret) {
  char c;
  int sgn;
  if (c = getchar(), c == EOF) return 0;
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  sgn = (c == '-') ? -1 : 1, ret = (c == '-') ? 0 : (c - '0');
  while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
  ret *= sgn;
  return 1;
}
template <class T>
inline void PT(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) PT(x / 10);
  putchar(x % 10 + '0');
}
const int N = 1e6 + 100;
int a[N];
int c[N], g[N];
int GCD[N];
bool vis[N];
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  int n;
  RD(n);
  for (int i = 1; i <= int(n); i++) GCD[i] = gcd(i, n);
  for (int i = 0; i < int(n); i++) RD(a[i]);
  long long ans = 0;
  for (int len = 1; len <= int(n - 1); len++) {
    if (n % len) continue;
    for (int i = 0; i < int(n + 1); i++) vis[i] = c[i] = 0;
    for (int p = 0; p < int(len); p++) {
      int mx = 0;
      for (int i = p; i < n; i += len) mx = max(mx, a[i]);
      for (int i = p; i < n; i += len) vis[i] = a[i] == mx;
    }
    bool ok = 0;
    for (int lb = 0; lb < n;) {
      int ub = (lb + 1) % n;
      if (vis[lb]) {
        lb++;
        continue;
      }
      ok = 1;
      int cnt = 0;
      while (vis[ub]) ub = (ub + 1) % n, cnt++;
      for (int i = 1; i <= int(cnt); i++) c[i] += cnt - i + 1;
      if (ub <= lb) break;
      lb = ub;
    }
    if (ok == 0)
      for (int i = 1; i <= int(n); i++) c[i] = n;
    for (int i = 1; i <= n; i++)
      if (GCD[i] == len) ans += c[i];
  }
  cout << ans << endl;
}
