#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 5;
vector<int> v[N / 2];
int a[N], maxi[N];
int gdc(int x, int y) {
  if (x == 0) return y;
  return gdc(y % x, x);
}
int main() {
  int n, i, x, j, index, cc;
  cin >> n;
  for (i = 0; i < n; ++i) cin >> a[i], a[i + n] = a[i];
  for (i = 1; i < n; ++i) {
    v[gdc(i, n)].push_back(i);
  }
  long long ret = 0;
  for (i = 1; i < n; ++i)
    if (v[i].size() > 0) {
      index = 0, cc = 0;
      memset(maxi, 0, sizeof(maxi));
      for (j = 0; j < n * 2; ++j) maxi[j % i] = max(maxi[j % i], a[j]);
      for (j = 0; j < n * 2; ++j) {
        if (a[j] >= maxi[j % i]) {
          ++cc;
          if (index < v[i].size() && v[i][index] <= cc) ++index;
          if (j >= n) ret += index;
        } else
          index = 0, cc = 0;
      }
    }
  cout << ret << endl;
}
