#include <bits/stdc++.h>
using namespace std;
int n, a[200010], mx[200010], cnt[200010], GCD[200010];
long long ans;
inline int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
inline void cal(int x) {
  memset(mx, 0, sizeof(mx));
  memset(cnt, 0, sizeof(cnt));
  for (int i = 0; i < n; i++) mx[i % x] = max(mx[i % x], a[i]);
  int pos = -1;
  for (int i = 0; i < n; i++)
    if (mx[i % x] != a[i]) {
      pos = i;
      break;
    }
  if (pos == -1) {
    for (int i = 1; i < n; i++)
      if (GCD[i] == x) ans += n;
    return;
  }
  for (int l = pos;;) {
    if (mx[l % x] != a[l])
      l = (l + 1) % n;
    else {
      int r = l;
      while (mx[(r + 1) % n % x] == a[(r + 1) % n]) r = (r + 1) % n;
      int len = (r - l + 1 + n) % n;
      if (!len) len = n;
      for (int i = len; i >= 1; i--) cnt[i] += len - i + 1;
      l = (r + 1) % n;
    }
    if (l == pos) break;
  }
  for (int i = 1; i < n; i++)
    if (GCD[i] == x) ans += cnt[i];
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) GCD[i] = gcd(i, n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 1; i < n; i++) {
    if (n % i == 0) cal(i);
  }
  printf("%lld\n", ans);
  return 0;
}
