#include <bits/stdc++.h>
using namespace std;
const int N = 400010;
int gcds[N], a[N], b[N];
int c[N], mx[N];
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i - 1]);
    gcds[i] = gcd(i, n);
  }
  long long ans = 0;
  for (int i = 1; i < n; i++) {
    if (n % i) continue;
    for (int j = 1; j <= n; j++) c[j] = c[j - 1] + (i == gcds[j]);
    for (int j = 0; j < i; j++) mx[j] = a[j];
    for (int j = i; j < n; j++) mx[j % i] = max(mx[j % i], a[j]);
    for (int j = 0; j < n; j++) b[j] = b[j + n] = mx[j % i] == a[j];
    for (int j = 2 * n - 2; j >= 0; j--)
      if (b[j]) b[j] += b[j + 1];
    for (int j = 0; j < n; j++) ans += c[min(n - 1, b[j])];
  }
  cout << ans << endl;
  return 0;
}
