#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
int factor[1005], tot, total, val[200005], _max[200005], g[200005];
long long ans;
void calc(int num, int k, bool mark) {
  for (int i = k; i <= num; i += k)
    if (g[i] == k)
      if (mark)
        ans += num - i + 1;
      else
        ans += num;
}
int main() {
  scanf("%d", &total);
  for (int i = 0; i < total; i++) scanf("%d", val + i);
  for (int i = 1; i * i <= total; i++) {
    if (total % i == 0) {
      factor[tot++] = i;
      if (i * i != total) factor[tot++] = total / i;
    }
  }
  sort(factor, factor + tot);
  for (int i = 0; i < tot; i++) {
    int k = factor[i];
    for (int j = k; j <= total; j += k) g[j] = k;
  }
  for (int i = 0; i < tot - 1; i++) {
    int k = factor[i];
    for (int j = total - 1; j >= 0; j--)
      if (total - j <= k)
        _max[j] = val[j];
      else
        _max[j] = max(val[j], _max[j + k]);
    int cur = 0, from = 0, to = total - 1;
    while (val[from] == _max[from % k]) from++;
    while (val[to] == _max[to % k]) to--;
    if (from <= to)
      cur = from + (total - to - 1);
    else {
      calc(total, k, 0);
      continue;
    }
    calc(cur, k, 1);
    cur = 0;
    for (int j = from; j <= to; j++)
      if (val[j] == _max[j % k])
        cur++;
      else {
        calc(cur, k, 1);
        cur = 0;
      }
  }
  cout << ans;
  return 0;
}
