#include <bits/stdc++.h>
using namespace std;
map<int, vector<int> > m;
int gcd(int a, int b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n;
  cin >> n;
  int a[n];
  bool allSame = true;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] != a[0]) {
      allSame = false;
    }
  }
  if (allSame) {
    cout << ((long long)n * (n - 1)) << endl;
    return 0;
  }
  int largest[n];
  for (int i = 1; 2 * i <= n; i++) {
    if (n % i) continue;
    m[i] = vector<int>();
    memset(largest, 0, sizeof(largest));
    for (int j = 0; j < n; j++) {
      largest[j % i] = max(largest[j % i], a[j]);
    }
    int ct = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] < largest[j % i]) {
        if (ct > 0) {
          m[i].push_back(ct);
          ct = 0;
        }
      } else {
        ct++;
      }
    }
    if (ct > 0 && m[i].size() > 0 && a[0] >= largest[0]) {
      m[i][0] += ct;
    } else if (ct > 0) {
      m[i].push_back(ct);
    }
    sort(m[i].begin(), m[i].end());
    reverse(m[i].begin(), m[i].end());
  }
  long long ans = 0;
  for (int i = 1; i < n; i++) {
    int d = gcd(n, i);
    for (auto len : m[d]) {
      if (len < i) {
        break;
      }
      if (len == n) {
        ans += n;
      } else {
        ans += len - i + 1;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
