#include <bits/stdc++.h>
using namespace std;
int N;
int A[200005];
vector<int> Max[200005], Aux[200005];
vector<int> Aux2[200005];
int Div[200005], cnt;
void Read() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
}
void precalcDiv() {
  for (int i = 1; i <= N; i++) {
    if (N % i != 0) continue;
    Div[++cnt] = i;
    int d = 0;
    Max[i].resize(i);
    for (int j = 0; j < N; j++) {
      Max[i][d] = max(Max[i][d], A[j]);
      ++d;
      if (d == i) d = 0;
    }
  }
}
void Solve(int d) {
  Aux[d].resize(N);
  int x = 0;
  for (int i = 0; i < N; i++) {
    int m = Max[d][x];
    ++x;
    if (x == d) x = 0;
    if (m == A[i]) {
      if (i > 0)
        Aux[d][i] = Aux[d][i - 1] + 1;
      else
        Aux[d][i] = 1;
    } else
      Aux[d][i] = 0;
  }
  x = 0;
  if (Aux[d][Aux[d].size() - 1] != N) {
    int p = Aux[d][Aux[d].size() - 1];
    for (int i = 0; i < N; i++) {
      int m = Max[d][x];
      ++x;
      if (x == d) x = 0;
      if (m == A[i]) {
        if (i > 0)
          Aux[d][i] = Aux[d][i - 1] + 1;
        else
          Aux[d][i] = 1 + p;
      } else
        break;
    }
  } else {
    for (int i = 0; i < N; i++) Aux[d][i] = N;
  }
  Aux2[d].resize(N + 1);
  for (int i = 0; i < Aux[d].size(); i++) Aux2[d][Aux[d][i]]++;
  for (int i = Aux2[d].size() - 2; i >= 0; i--) Aux2[d][i] += Aux2[d][i + 1];
}
int getAns(int pos, int s) { return Aux2[pos][s]; }
int gcd(int a, int b) {
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
void findSol() {
  for (int i = 1; i <= cnt; i++) {
    Solve(Div[i]);
  }
  long long res = 0;
  for (int s = N - 1; s > 0; s--) {
    res += getAns(gcd(s, N), s);
  }
  printf("%I64d\n", res);
}
int main() {
  Read();
  precalcDiv();
  findSol();
  return 0;
}
