#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return (gcd(b, a % b));
}
const int N = 1000100;
int n, a[N], c[N], gg[N];
bool u[N];
int inc(int x) {
  if (x + 1 == n)
    return 0;
  else
    return (x + 1);
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) gg[i] = gcd(i, n);
  long long ans = 0;
  for (int g = 1; g < n; g++) {
    if (n % g != 0) continue;
    for (int i = 0; i < n; i++) {
      u[i] = false;
      c[i] = 0;
    }
    for (int i = 0; i < g; i++) {
      int mx = 0;
      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 any = false;
    for (int j = 0; j < n;) {
      int r = inc(j);
      if (u[j]) {
        j++;
        continue;
      }
      any = 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 <= j) break;
      j = r;
    }
    if (!any)
      for (int i = 1; i <= n; i++) c[i] += n;
    for (int i = 1; i <= n; i++)
      if (gg[i] == g) ans += c[i];
  }
  cout << ans << endl;
  return 0;
}
