#include <bits/stdc++.h>
using namespace std;
void solve(int test_number);
int main() {
  cout.setf(ios::fixed);
  cout.precision(9);
  cerr.setf(ios::fixed);
  cerr.precision(3);
  int n = 1;
  for (int i = 0; i < n; i++) {
    solve(i + 1);
  }
  return 0;
}
const int MAXN = 200100;
const int BUBEN = 800;
int n;
int a[MAXN];
int d[MAXN];
int nd;
bool used[BUBEN][MAXN];
int sum[BUBEN];
vector<int> q[MAXN];
int st[MAXN];
inline int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
void solve(int test_number) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      d[nd++] = i;
      int j = n / i;
      if (i != j && j != n) d[nd++] = j;
    }
  }
  sort(d, d + nd);
  for (int j = 0; j < nd; j++) {
    int step = d[j];
    for (int from = 0; from < step; from++) {
      int mx = a[from];
      for (int i = from; i < n; i += step) {
        mx = max(mx, a[i]);
      }
      for (int i = from; i < n; i += step) {
        if (mx == a[i]) {
          used[j][i] = true;
        }
      }
    }
    int last = -1;
    int pref = 0;
    for (int i = 0; i < n; i++)
      if (used[j][i]) {
        if (last == -1) last = i;
      } else if (last != -1) {
        if (last == 0) {
          pref = i - last;
        } else {
          q[j].push_back(i - last);
          sum[j] += i - last;
        }
        last = -1;
      }
    if (last != -1) {
      pref += n - last;
    }
    q[j].push_back(pref);
    sum[j] += pref;
    sort(q[j].begin(), q[j].end());
  }
  long long res = 0;
  for (int len = 1; len < n; len++) {
    int step = gcd(len, n);
    long long j = lower_bound(d, d + nd, step) - d;
    while ((int)q[j].size() != st[j] && q[j][st[j]] < len) {
      sum[j] -= q[j][st[j]];
      st[j]++;
    }
    if (sum[j] == n) {
      res += (long long)n;
    } else {
      res += (long long)sum[j] -
             (long long)(len - 1) * (long long)(q[j].size() - st[j]);
    }
  }
  cout << res << endl;
}
