#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0);
const int MAXN = 200001;
int ad[MAXN];
int an[MAXN];
int g[MAXN], gc = 0;
int dv[MAXN];
int a[MAXN];
bool b[MAXN];
int gcd(int a, int b) {
  while (b != 0) {
    int c = a % b;
    a = b;
    b = c;
  }
  return a;
}
int main() {
  int n;
  cin >> n;
  cin >> a[0];
  for (int i = 1; i < n; i++) {
    cin >> a[i];
    dv[i] = gcd(i, n);
    g[gc++] = dv[i];
  }
  sort(g, g + gc);
  gc = unique(g, g + gc) - g;
  long long ans = 0;
  for (int it = 0; it < gc; it++) {
    int d = g[it];
    for (int i = 1; i <= n; i++) ad[i] = 0;
    for (int i = 0; i < d; i++) {
      int mx = 0;
      for (int j = i; j < n; j += d) mx = max(mx, a[j]);
      for (int j = i; j < n; j += d) b[j] = (a[j] == mx);
    }
    int st = -1;
    for (int i = 0; i < n; i++) {
      if (!b[i]) st = i;
    }
    if (st == -1) {
      for (int i = 1; i <= n; i++) an[i] = n;
    } else {
      int cur = st, ln = 0;
      do {
        cur = (cur + 1) % n;
        if (b[cur])
          ln++;
        else {
          ad[ln]++;
          ln = 0;
        }
      } while (cur != st);
      int ss = 0;
      an[n] = 0;
      for (int i = n - 1; i >= 1; i--) {
        ss += ad[i];
        an[i] = an[i + 1] + ss;
      }
    }
    for (int i = 1; i <= n; i++) {
      if (dv[i] == d) ans += an[i];
    }
  }
  cout << ans << endl;
  return 0;
}
