#include <bits/stdc++.h>
using namespace std;
inline void readi(int &x);
const int maxn = 200005;
int n;
long long ans;
int a[maxn * 2], c[maxn * 2], b[maxn];
vector<int> v[maxn];
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int calc(int g, int l) {
  int low = -1, high = v[g].size(), mid;
  while (low + 1 < high) {
    mid = low + high >> 1;
    if (c[l + v[g][mid]] - c[l] == 0)
      low = mid;
    else
      high = mid;
  }
  return low + 1;
}
int main() {
  readi(n);
  for (int i = 0; i < n; i++) readi(a[i]), a[i + n] = a[i];
  a[n + n] = a[0];
  for (int i = 1; i < n; i++) v[gcd(n, i)].push_back(i);
  for (int g = 1; g < n; g++)
    if (!v[g].empty()) {
      memset(b, 0, n + 1 << 2);
      for (int i = 0; i < n; i++) b[i % g] = max(b[i % g], a[i]);
      c[0] = 0;
      for (int i = 0; i <= n + n; i++) {
        if (a[i] >= b[i % g])
          c[i + 1] = c[i];
        else
          c[i + 1] = c[i] + 1;
      }
      for (int i = 0; i < n; i++) ans += calc(g, i);
    }
  cout << ans << endl;
  return 0;
}
inline void readi(int &x) {
  char c;
  while (c = getchar(), c < '0' || c > '9')
    ;
  x = c ^ '0';
  while (c = getchar(), c >= '0' && c <= '9') x = x * 10 + (c ^ '0');
}
