#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 1;
const double pi = acos(-1.0);
const int N = 300010;
int n, a[N], b[N], x[N], f[N];
bool isMax[N];
int gcd(int a, int b) {
  if (!b) return a;
  return gcd(b, a % b);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) b[i] = gcd(i, n);
  long long ans = 0;
  for (int k = 1; k < n; k++)
    if (n % k == 0) {
      f[0] = 0;
      if (b[1] == k)
        f[1] = 1;
      else
        f[1] = 0;
      for (int j = 2; j <= n; j++)
        if (b[j] == k)
          f[j] = f[j - 1] + 1;
        else
          f[j] = f[j - 1];
      for (int j = 0; j < k; j++) {
        int mx = 0;
        for (int i = j; i < n; i += k) {
          mx = max(mx, a[i]);
        }
        for (int i = j; i < n; i += k) {
          if (a[i] == mx)
            isMax[i] = true;
          else
            isMax[i] = false;
        }
      }
      if (!isMax[n - 1])
        x[n - 1] = 0;
      else {
        x[n - 1] = 1;
        for (int i = 0; i < n - 2; i++)
          if (isMax[i])
            x[n - 1]++;
          else
            break;
      }
      for (int i = n - 2; i >= 0; i--)
        if (isMax[i])
          x[i] = min(n - 1, x[i + 1] + 1);
        else
          x[i] = 0;
      for (int i = 0; i < n; i++) ans += f[x[i]];
    }
  cout << ans;
  return 0;
}
