#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
const int M = 100;
const int inf = (int)1e9 + 7;
const long long base = (long long)1e18;
const double pi = acos(-1);
const double ep = 1e-18;
vector<int> p;
int n;
int a[N];
int mx[N];
bool check[2 * N];
int gcd(int a, int b) { return (a == 0) ? b : gcd(b % a, a); }
void solve() {
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  long long ans = 0;
  for (int d = 1; d <= n; d++) {
    if (n % d == 0) {
      for (int j = 0; j < d; j++) mx[j] = 0;
      for (int i = 0; i < n; i++) {
        int k = i % d;
        mx[k] = max(mx[k], a[i]);
      }
      for (int i = 0; i < n; i++)
        if (a[i] == mx[i % d])
          check[i] = 1;
        else
          check[i] = 0;
      for (int i = 0; i < n; i++) {
        check[i + n] = check[i];
      }
      int i = 0;
      while (i < 2 * n) {
        if (check[i]) {
          int j = i;
          while (j < 2 * n && check[j]) j++;
          int len = j - i;
          for (int t = d; t <= min(len, n - 1); t += d) {
            if (gcd(n, t) == d) {
              ans += max(0, min(j - i - t + 1, n - i));
            }
          }
          i = j;
        } else
          i++;
      }
    }
  }
  cout << ans;
}
int main() {
  solve();
  return 0;
}
