#include <bits/stdc++.h>
using namespace std;
const long long maxn = 200005;
long long n;
long long a[maxn];
long long Gcd[maxn];
long long c[maxn], ismax[maxn];
long long gcd(long long a, long long b) {
  if (!b)
    return a;
  else
    return gcd(b, a % b);
}
long long inc(long long v) {
  v++;
  return v % n;
}
int main() {
  while (scanf("%I64d", &n) == 1) {
    for (long long i = 0; i < n; i++) scanf("%I64d", &a[i]);
    for (long long i = 1; i <= n; i++) Gcd[i] = gcd(i, n);
    long long res = 0;
    for (long long GCD = 1; GCD < n; GCD++) {
      if (n % GCD != 0) continue;
      for (long long i = 0; i < n; i++) ismax[i] = 0, c[i] = 0;
      for (long long i = 0; i < GCD; i++) {
        long long Max = -1;
        for (long long j = i; j < n; j += GCD) Max = max(Max, a[j]);
        for (long long j = i; j < n; j += GCD)
          if (a[j] == Max) ismax[j] = 1;
      }
      bool any = false;
      for (long long l = 0; l < n;) {
        long long r = inc(l);
        if (ismax[l]) {
          l++;
          continue;
        }
        any = true;
        long long len = 0;
        while (ismax[r]) {
          r = inc(r);
          len++;
        }
        for (long long i = 1; i <= len; i++) c[i] += len - i + 1;
        if (r <= l) break;
        l = r;
      }
      if (!any)
        for (long long i = 1; i <= n; i++) c[i] += n;
      for (long long i = 1; i <= n; i++)
        if (Gcd[i] == GCD) res += c[i];
    }
    printf("%I64d\n", res);
  }
  return 0;
}
