#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2 * 105000;
int n, pn;
int a[MAXN];
int curmax[200][MAXN];
vector<int> v;
bool ok[MAXN];
int mx;
long long ans = 0;
int s[MAXN];
int g[MAXN];
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
vector<int> lens;
int pref[MAXN];
void fact(int n) {
  for (int i = 1; i < n; i++) {
    if (n % i == 0) {
      v.push_back(i);
    }
  }
}
set<int> st;
int main() {
  cin >> n;
  mx = -5;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i] > mx) mx = a[i];
    st.insert(a[i]);
  }
  for (int i = 1; i < n; i++) {
    g[i] = gcd(i, n);
  }
  fact(n);
  pn = (int)v.size();
  for (int j = 0; j < pn; j++) {
    int cur = v[j];
    if (cur == 1) {
      for (int i = 0; i < n; i++) {
        if (a[i] == mx) {
          ok[i] = true;
        } else
          ok[i] = false;
      }
    } else {
      for (int i = 0; i < n; i++) {
        if (curmax[j][i] == 0) {
          int mx = a[i];
          int go = (i + cur) % n;
          while (go != i) {
            if (a[go] > mx) mx = a[go];
            go = (go + cur) % n;
          }
          go = (i + cur) % n;
          curmax[j][i] = mx;
          while (go != i) {
            curmax[j][go] = mx;
            go = (go + cur) % n;
          }
        }
        if (a[i] == curmax[j][i]) {
          ok[i] = true;
        } else {
          ok[i] = false;
        }
      }
    }
    for (int i = 0; i < n; i++) {
      if (ok[i]) {
        if (i == 0)
          pref[i] = 1;
        else
          pref[i] = 1 + pref[i - 1];
      } else {
        pref[i] = 0;
      }
    }
    memset(s, 0, sizeof(s));
    for (int i = 0; i < n; i++) {
      int total = pref[i];
      if (total == i + 1) {
        total += pref[n - 1];
        if (total >= n) {
          total = n;
        }
      }
      s[total]++;
    }
    for (int i = n; i >= 1; i--) {
      s[i] += s[i + 1];
    }
    int p = 1;
    for (int i = 1; i < n; i++) {
      if (g[i] == cur) {
        while (p < i) {
          p++;
        }
        ans += s[p];
      }
    }
  }
  cout << ans << endl;
  return 0;
}
