#include <bits/stdc++.h>
using namespace std;
const int N = 600005;
int base = 1000000 + 25;
long long ans = 0;
int pw[N + 5];
vector<int> divs;
vector<int> g[505];
vector<int> H[505];
int F[N];
int val[N];
int h[N + 5];
int a[N];
int n;
bool prime(int n) {
  for (int i = 2; i * i <= n; ++i)
    if (n % i == 0) return false;
  return true;
}
inline int getHash(int l, int r) {
  int ret = h[r];
  if (l) ret -= h[l - 1];
  ret *= pw[N - l];
  return ret;
}
inline int getHashFromGcd(int c, int pos) {
  int l = pos, r = pos + divs[c] - 1;
  int ret = H[c][r];
  if (l) ret -= H[c][l - 1];
  ret *= pw[N - l];
  return ret;
}
int gcd(int a, int b) {
  while (a > 0 && b > 0)
    if (a > b)
      a %= b;
    else
      b %= a;
  return (a + b);
}
int main() {
  while (!prime(base)) base++;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    a[i + n] = a[i];
  }
  for (int i = 1; i < n; ++i) {
    if (n % i == 0) {
      divs.push_back(i);
    }
  }
  pw[0] = 1;
  for (int i = 1; i <= N; ++i) {
    pw[i] = pw[i - 1] * base;
  }
  for (int i = 0; i < divs.size(); ++i) {
    g[i].resize(2 * divs[i]);
    for (int j = 0; j < n; ++j)
      g[i][j % divs[i]] = max(g[i][j % divs[i]], a[j]);
    for (int j = 0; j < divs[i]; ++j) g[i][j + divs[i]] = (g[i][j]);
    int cur = 0;
    for (int j = 0; j < divs[i] * 2; ++j) {
      cur = cur + g[i][j] * pw[j];
      H[i].push_back(cur);
    }
  }
  int cur = 0;
  for (int i = 0; i < 2 * n; ++i) {
    cur = cur + a[i] * pw[i];
    h[i] = cur;
  }
  int res = 0;
  for (int j = 0; j < divs.size(); ++j) {
    int last = 0;
    for (int i = 1; i <= n / divs[j]; ++i) {
      last += gcd(i, n / divs[j]) == 1;
      F[i - 1] = last;
    }
    for (int i = 0; i < n + n; ++i) {
      if (i + divs[j] - 1 >= n + n) {
        val[i] = 0;
        continue;
      }
      int H = getHashFromGcd(j, i % divs[j]);
      if (H == getHash(i, i + divs[j] - 1))
        val[i] = 1;
      else
        val[i] = 0;
    }
    for (int i = n + n - 1; i >= 0; --i) {
      if (val[i]) {
        val[i] = val[i + divs[j]] + 1;
        if (val[i] >= n / divs[j]) val[i] = n / divs[j] - 1;
        if (i < n) ans += F[val[i] - 1];
      }
    }
  }
  cout << ans << endl;
  return 0;
}
