#include <bits/stdc++.h>
using namespace std;
const int M = 400005;
int gcd(int x, int y) { return !y ? x : gcd(y, x % y); }
int n;
bool mark[M];
int c[M];
int A[M], dp[M], cnt[M];
int Gcd[M];
int main() {
  cin >> n;
  for (int i = 0; i <= n; ++i) Gcd[i] = gcd(i, n);
  for (int i = 0; i < n; ++i) cin >> A[i];
  for (int i = n; i < n + n; ++i) A[i] = A[i - n];
  long long ans = 0;
  for (int d = 1; d <= n; ++d) {
    if (n % d) continue;
    memset(mark, 0, sizeof(mark));
    for (int i = 0; i < d; ++i) {
      int mx = 0;
      for (int j = i; j < n + n; j += d)
        if (A[j] > mx) mx = A[j];
      for (int j = i; j < n + n; j += d)
        if (A[j] == mx) mark[j] = true;
    }
    dp[0] = mark[0];
    for (int i = 1; i < n + n; ++i) {
      if (mark[i])
        dp[i] = dp[i - 1] + 1;
      else
        dp[i] = 0;
      dp[i] = min(dp[i], n - 1);
    }
    cnt[0] = 0;
    for (int i = 1; i < n; ++i) cnt[i] = cnt[i - 1] + (Gcd[i] == d);
    for (int i = n; i < n + n; ++i) ans += cnt[dp[i]];
  }
  cout << ans << endl;
}
