#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const int M = 105;
const int nmax = 5e3 + 5;
const long long inf = 1e9;
const int mod = 1e9 + 9;
const long long P = 31;
int a[N];
int g[N];
int gcd(int a, int b) { return (!b ? a : gcd(b, a % b)); }
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; ++i) {
    g[i] = gcd(i, n);
  }
  long long ans = 0;
  for (int i = 1; i < n; ++i) {
    if (n % i != 0) continue;
    vector<int> v(i, -1);
    vector<long long> c(n + 1, 0);
    for (int d = 0; d < i; ++d) {
      for (int j = d; j < n; j += i) v[d] = max(v[d], a[j]);
    }
    int ok = 0;
    for (int l = 0; l < n;) {
      int r = (l + 1) % n;
      if (a[l] == v[l % i]) {
        l++;
        continue;
      }
      ok = 1;
      int len = 0;
      while (a[r] == v[r % i]) {
        len++;
        r = (r + 1) % n;
      }
      for (int k = 1; k <= len; ++k) {
        c[k] += len - k + 1;
      }
      if (r <= l) break;
      l = r;
    }
    if (!ok) {
      for (int s = 1; s <= n; ++s) c[s] += n;
    }
    for (int s = 1; s <= n; ++s) {
      if (g[s] == i) ans += c[s];
    }
  }
  cout << ans << '\n';
  return 0;
}
