#include <bits/stdc++.h>
const int INF = 1e9;
const long long lINF = 1e18;
const double EPS = 1e-12;
using namespace std;
const int N = 2e5 + 100;
int n;
int a[N];
long long ans[N];
int g[N];
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    g[i] = gcd(i, n);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
  }
  vector<int> dels;
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      dels.push_back(i);
      if (n != i * i) {
        dels.push_back(n / i);
      }
    }
  }
  sort((dels).begin(), (dels).end());
  for (auto cur : dels) {
    vector<int> mx(cur, 0);
    for (int j = 0; j < cur; j++) {
      for (int i = j; i < n; i += cur) {
        mx[j] = max(mx[j], a[i]);
      }
    }
    vector<int> v;
    int r = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] == mx[i % cur]) {
        r++;
      } else {
        if (r > 0) {
          v.push_back(r);
          r = 0;
        }
      }
    }
    if (r > 0) {
      if (((int)((v).size())) >= 1 && a[0] == mx[0]) {
        v[0] += r;
      } else {
        v.push_back(r);
      }
    }
    if (v[0] != n) {
      for (auto i : v) {
        for (int j = cur; j <= i; j += cur) {
          if (g[j] == cur) {
            ans[j] += i - j + 1;
          }
        }
      }
    } else {
      for (int j = cur; j <= v[0]; j += cur) {
        if (g[j] == cur) {
          ans[j] += v[0];
        }
      }
    }
  }
  long long res = 0;
  for (int i = 0; i < n; i++) {
    res += ans[i];
  }
  printf(
      "%lld"
      "\n",
      res);
  return 0;
}
