#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(vector<T> v) {
  for (int i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  cout << endl;
}
long long gcd(long long u, long long v) {
  while (v != 0) {
    long long r = u % v;
    u = v;
    v = r;
  }
  return u;
}
int main() {
  int N;
  cin >> N;
  vector<int> v;
  int i;
  for (i = 0; i < N; i++) {
    int a;
    cin >> a;
    v.push_back(a);
  }
  vector<int> gcdtable(N, 0);
  for (i = 1; i < N; i++) gcdtable[i] = gcd(N, i);
  long long res = 0;
  int d;
  for (d = 1; d < N; d++) {
    if (N % d != 0) continue;
    vector<int> g;
    int x, y;
    for (x = d; x < N; x += d)
      if (gcdtable[x] == d) g.push_back(x);
    vector<int> mark(N, 0);
    int r;
    for (r = 0; r < d; r++) {
      int cmax = 0;
      for (x = r; x < N; x += d) cmax = max(cmax, v[x]);
      for (x = r; x < N; x += d)
        if (v[x] == cmax) mark[x] = 1;
    }
    x = 0;
    while (x < N) {
      if (mark[x % N] == 0) {
        x++;
        continue;
      }
      y = x;
      while (y < 2 * N) {
        if (mark[y % N] == 1) {
          y++;
          continue;
        } else
          break;
      }
      for (int& z : g) {
        if (z >= y - x + 1) break;
        if (y - z < N)
          res += max(y - x - z + 1, 0);
        else
          res += max(N - x, 0);
      }
      x = y;
    }
  }
  cout << res << endl;
  return 0;
}
