#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  while (a && b) a > b ? a %= b : b %= a;
  return a + b;
}
vector<int> divs(int x) {
  vector<int> res;
  for (int i = 1; i <= x; i++) {
    if (x % i == 0) res.push_back(i);
  }
  return res;
}
int n, ar[1 << 20];
long long ans;
int mx[1 << 20];
int total[1 << 20], f[1 << 20];
long long solve(int G) {
  for (int i = 0; i < G; i++) mx[i] = -1;
  for (int i = 0; i < n; i++) mx[i % G] = max(mx[i % G], ar[i]);
  for (int i = 1; i <= n * 2; i++) {
    total[i] = total[i - 1];
    if (f[i] == G) ++total[i];
  }
  long long res = 0;
  int ptr = -1;
  for (int i = 0; i < n * 2; i++) {
    int need = mx[i % G];
    if (ar[i] != need) {
      ptr = i;
      continue;
    }
    if (i < n) continue;
    int span = i - ptr;
    res += total[span];
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> ar[i];
  for (int i = n; i < n * 2; i++) ar[i] = ar[i - n];
  for (int i = 1; i <= n; i++) f[i] = gcd(i, n);
  vector<int> vals = divs(n);
  for (int i = 0; i < vals.size(); i++) {
    ans += solve(vals[i]);
  }
  cout << ans - n << endl;
  return 0;
}
