#include <bits/stdc++.h>
using namespace std;
int A[200005 << 1], n, ln[200005 << 1], C[200005 + 200005];
long long ans;
bool mark[200005 << 1];
int Gcd(int a, int b) { return b ? Gcd(b, a % b) : a; }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &A[i]);
    A[i + n] = A[i];
  }
  for (int i = 1; i <= n; i++) {
    if (n % i) continue;
    memset(mark, 0, sizeof(mark));
    for (int j = 0; j < i; j++) {
      int mx = 0;
      for (int t = j; t < n + n; t += i) mx = max(mx, A[t]);
      for (int t = j; t < n + n; t += i)
        if (A[t] == mx) mark[t] = true;
    }
    ln[0] = mark[0];
    for (int j = 1; j < n + n; j++) {
      if (mark[j] == true)
        ln[j] = ln[j - 1] + 1;
      else
        ln[j] = 0;
      if (ln[j] == n) ln[j]--;
    }
    C[0] = 0;
    for (int j = 1; j < (n / i); j++) C[j] = C[j - 1] + (Gcd(j, n / i) == 1);
    for (int j = n; j < n + n; j++) ans += C[ln[j] / i];
  }
  cout << ans << endl;
  return 0;
}
