#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
int n, divN;
vector<int> a;
set<int> DIV;
map<int, int> p;
map<int, int> lens[100000];
void addDiv(map<int, int>::iterator it, int curr) {
  if (it == p.end()) return;
  int t = 1;
  for (int i = 0; i < (int)it->second + 1; i++) {
    DIV.insert(curr * t);
    map<int, int>::iterator it1 = it;
    it1++;
    addDiv(it1, curr * t);
    t *= it->first;
  }
}
void setDiv(int n) {
  while (n % 2 == 0) p[2]++, n /= 2;
  int eIdx = int(sqrt(double(n))) + 10, idx = 3;
  while (idx < eIdx && n > 1) {
    while (n % idx == 0) p[idx]++, n /= idx;
    idx += 2;
  }
  if (n > 1) p[n]++;
  addDiv(p.begin(), 1);
}
int getGCD(int a, int b) {
  if (b == 0) return a;
  if (a < b) return getGCD(b, a);
  if (a % b == 0) return b;
  return getGCD(b, a % b);
}
int main() {
  cin >> n;
  a.resize(n);
  setDiv(n);
  divN = DIV.size();
  for (int i = 0; i < (int)n; i++) cin >> a[i];
  int cnt = 0;
  for (set<int>::iterator it = DIV.begin(); it != DIV.end(); it++, cnt++) {
    int t = getGCD(n, *it);
    if (t == n) break;
    vector<int> maxVal(t, 0);
    vector<bool> isMax(n, 0);
    for (int i = 0; i < (int)n; i++) {
      int idx = i % t;
      if (maxVal[idx] < a[i]) maxVal[idx] = a[i];
    }
    for (int i = 0; i < (int)n; i++) {
      int idx = i % t;
      if (maxVal[idx] == a[i]) isMax[i] = 1;
    }
    int fIdx = -1;
    for (int i = 0; i < (int)n; i++) {
      if (!isMax[i]) {
        fIdx = i;
        break;
      }
    }
    if (fIdx == -1) {
      lens[cnt][n]++;
      ;
    } else {
      int cnt1 = 0;
      for (int i = fIdx; i < (int)fIdx + n; i++) {
        int idx = i % n;
        if (isMax[idx])
          cnt1++;
        else {
          if (cnt1) lens[cnt][cnt1]++;
          cnt1 = 0;
        }
      }
      if (cnt1) {
        lens[cnt][cnt1]++;
      }
    }
  }
  long long ans = 0;
  for (int k = 1; k < n; k++) {
    int t = getGCD(n, k);
    set<int>::iterator it = DIV.lower_bound(t);
    int idx = distance(DIV.begin(), it);
    for (map<int, int>::iterator it = lens[idx].begin(); it != lens[idx].end();
         it++) {
      if (it->first == n) {
        ans += n;
        break;
      }
      if (it->first >= k) {
        ans += (it->first - k + 1) * it->second;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
