#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
long long a[2 * 100000];
bool b[2 * 100000];
long long c[2 * 100000 + 1];
long long n;
long long f[2 * 100000];
int main() {
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (long long i = 1; i <= n - 1; ++i) f[i] = gcd(n, i);
  long long sol = 0;
  for (long long fac = 1; fac < n; ++fac) {
    if (n % fac != 0) continue;
    fill_n(b, n, false);
    fill_n(c, n, 0);
    for (long long st = 0; st < fac; ++st) {
      long long m = 0;
      for (long long pos = st; pos < n; pos += fac) {
        m = max(m, a[pos]);
      }
      for (long long pos = st; pos < n; pos += fac) {
        if (a[pos] == m) b[pos] = true;
      }
    }
    auto inc = [](long long i) -> long long { return (i + 1) % n; };
    long long start = 0;
    if (b[0] && b[n - 1]) {
      start++;
      while (b[start] && start % n != 0) start++;
    }
    start %= n;
    for (long long begin = start; begin < n; ++begin) {
      if (!b[begin]) {
        continue;
      }
      long long end = inc(begin);
      long long size = 1;
      while (b[end] && end != begin && size < n) {
        end = inc(end);
        size++;
      }
      if (size == n)
        for (long long j = 1; j <= size; ++j) c[j] = size;
      else
        for (long long j = 1; j <= size; ++j) c[j] += (size - j + 1);
      begin = end > begin ? end : n;
    }
    for (long long i = 1; i <= n - 1; ++i) {
      if (f[i] != fac) continue;
      sol += c[i];
    }
  }
  cout << sol << endl;
  return 0;
}
