#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int main() {
  int n;
  cin >> n;
  int niza[n];
  for (int ctr1 = 0; ctr1 < n; ctr1++) cin >> niza[ctr1];
  vector<int> vek[n + 1];
  for (int ctr1 = 1; ctr1 < n; ctr1++) vek[gcd(ctr1, n)].push_back(ctr1);
  long long rez = 0;
  int big[n];
  bool ok[n * 2];
  for (int ctr1 = 1; ctr1 <= n; ctr1++) {
    if (vek[ctr1].size() == 0) continue;
    memset(big, -1, sizeof(big));
    for (int ctr2 = 0; ctr2 < n; ctr2++)
      if (niza[ctr2] > big[ctr2 % ctr1]) big[ctr2 % ctr1] = niza[ctr2];
    for (int ctr2 = 0; ctr2 < 2 * n; ctr2++)
      ok[ctr2] = (niza[ctr2 % n] >= big[ctr2 % ctr1]);
    int cons = 0;
    for (int ctr2 = 0; ctr2 < 2 * n; ctr2++) {
      if (ok[ctr2])
        cons++;
      else
        cons = 0;
      if (ctr2 >= n)
        rez += upper_bound(vek[ctr1].begin(), vek[ctr1].end(), cons) -
               vek[ctr1].begin();
    }
  }
  cout << rez << endl;
  return 0;
}
