#include <bits/stdc++.h>
#pragma comment(linker, "/stack:32000000")
using namespace std;
const int INF = 2147483647;
const long long LLINF = 9223372036854775807LL;
int gcd(int x, int y) { return x ? gcd(y % x, x) : y; }
long long solve(const vector<int>& a, int len) {
  vector<int> best(len);
  int rem = 0;
  for (int i = 0; i < int((a).size()); ++i) {
    best[rem] = max(best[rem], a[i]);
    ++rem;
    if (rem == len) rem = 0;
  }
  int bestcnt = int((a).size()) / len - 1;
  vector<int> f(bestcnt + 1);
  for (int i = 1; i < int((f).size()); ++i)
    f[i] = gcd(i, int((a).size()) / len) == 1;
  for (int i = 0; i < int((f).size()) - 1; ++i) f[i + 1] += f[i];
  long long ans = 0;
  rem = 0;
  int curi = 0;
  int curlen = 0;
  for (int ii = 0; ii < 2 * int((a).size()); ++ii) {
    if (a[curi] == best[rem])
      curlen++;
    else
      curlen = 0;
    if (ii >= int((a).size())) ans += f[min(curlen / len, bestcnt)];
    curi++;
    if (curi == int((a).size())) curi = 0;
    ++rem;
    if (rem == len) rem = 0;
  }
  return ans;
}
int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  bool same = true;
  for (int i = 0; i < n; ++i) same &= a[i] == a[0];
  if (same) {
    long long ans = n * (long long)(n - 1);
    cout << ans << endl;
    return 0;
  }
  long long ans = 0;
  for (int i = 1; i < n; ++i) {
    if (n % i == 0) {
      long long tans = solve(a, i);
      ans += tans;
    }
  }
  cout << ans << endl;
  return 0;
}
