#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int M = 10 + 7;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-6;
int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }
int n, mx, a[N << 1], cnt[N << 1], f[N << 1];
bool flag[N << 1];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    a[i + n] = a[i];
  }
  long long ans = 0;
  for (int d = 1; d < n; d++) {
    if (n % d) continue;
    memset(flag, false, sizeof(flag));
    for (int k = 0; k < d; k++) {
      mx = 0;
      for (int i = k; i < 2 * n; i += d) mx = max(mx, a[i]);
      for (int i = k; i < 2 * n; i += d) flag[i] = (a[i] == mx);
    }
    f[0] = flag[0];
    for (int i = 1; i < 2 * n; i++) {
      if (flag[i])
        f[i] = f[i - 1] + 1;
      else
        f[i] = 0;
      f[i] = min(f[i], n - 1);
    }
    cnt[0] = 0;
    for (int i = 1; i < n / d; i++) cnt[i] = cnt[i - 1] + (gcd(i, n / d) == 1);
    for (int i = n; i < n * 2; i++) ans += cnt[f[i] / d];
  }
  printf("%lld\n", ans);
  return 0;
}
