#include <bits/stdc++.h>
using namespace std;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
long long ln, lk, lm;
int a[200005];
int gcd1(int x, int y) {
  int z = y;
  while (x % y != 0) {
    z = x % y;
    x = y;
    y = z;
  }
  return z;
}
unordered_map<int, int> id;
int cnt;
int dp[170][200005];
void cal(int len) {
  if (len == n) return;
  if (id.find(len) != id.end()) return;
  id[len] = ++cnt;
  vector<int> v(len);
  for (int i = 0; i < len; i++) {
    for (int j = i; j < n; j += len) v[i] = max(v[i], a[j]);
  }
  for (int i = n - 1 + n - 1, pre = 0; i >= 0; i--) {
    int mx = v[i % len];
    int fg = mx == a[i % n];
    if (fg)
      pre++;
    else
      pre = 0;
    if (i < n && pre >= len) {
      dp[cnt][min(pre, n - 1)]++;
    }
  }
  for (int i = n - 2; i >= len; i--) dp[cnt][i] += dp[cnt][i + 1];
}
void fmain() {
  scanf("%d", &n);
  for (int(i) = 0; (i) < (int)(n); (i)++) scanf("%d", a + i);
  for (int i = 1; i * i <= n; i++)
    if (n % i == 0) {
      cal(i);
      cal(n / i);
    }
  long long ans = 0;
  for (int len = 1; len < n; len++) {
    int g = gcd1(len, n);
    ans += dp[id[g]][len];
  }
  printf("%lld\n", ans);
}
int main() {
  fmain();
  return 0;
}
