#include <bits/stdc++.h>
using namespace std;
int arr[200005];
vector<int> vec[200005];
int crr[200005 << 1];
int f[200005 << 1];
int ma[200005];
int n;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", arr + i);
  }
  for (int i = 1; i < n; i++) {
    vec[gcd(i, n)].push_back(i);
  }
  long long res = 0;
  for (int i = 1; i < n; i++) {
    if (vec[i].size() == 0) continue;
    int d = gcd(i, n);
    for (int j = 0; j < d; j++) {
      ma[j] = 0;
    }
    for (int j = 0; j < n; j++) {
      if (ma[j % d] < arr[j]) {
        ma[j % d] = arr[j];
      }
    }
    for (int j = 0; j < 2 * n - 1; j++) {
      int val = j >= n ? arr[j - n] : arr[j];
      if (val == ma[j % d]) {
        crr[j] = 1;
      } else {
        crr[j] = 0;
      }
    }
    f[2 * n - 1] = 0;
    vector<int>::iterator it = vec[i].begin();
    int cur = 0;
    for (int j = 2 * n - 2; j >= 0; j--) {
      if (crr[j] == 0)
        f[j] = 0;
      else
        f[j] = f[j + 1] + 1;
      if (f[j] == 0) {
        cur = 0;
        it = vec[i].begin();
      } else {
        if (it == vec[i].end()) {
        } else {
          if (f[j] == (*it)) {
            cur++;
            it++;
          } else {
          }
        }
      }
      if (j < n) {
        res += cur;
      }
    }
  }
  cout << res << endl;
  return 0;
}
